diff options
Diffstat (limited to 'hurd')
-rw-r--r-- | hurd/Makefile | 2 | ||||
-rw-r--r-- | hurd/hurdioctl.c | 31 |
2 files changed, 31 insertions, 2 deletions
diff --git a/hurd/Makefile b/hurd/Makefile index c807fac657..35dd3173b3 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -40,7 +40,7 @@ user-interfaces := $(addprefix hurd/,\ msg msg_reply msg_request \ exec exec_startup crash interrupt \ fs fsys io term tioctl socket ifsock \ - login password \ + login password pfinet \ ) server-interfaces := hurd/msg faultexc diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c index 073c15edcc..c4cb6798c2 100644 --- a/hurd/hurdioctl.c +++ b/hurd/hurdioctl.c @@ -1,5 +1,5 @@ /* ioctl commands which must be done in the C library. - Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1994,95,96,97,99,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -300,3 +300,32 @@ tiocnotty (int fd, return 0; } _HURD_HANDLE_IOCTL (tiocnotty, TIOCNOTTY); + +#include <hurd/pfinet.h> +#include <net/if.h> +#include <netinet/in.h> + +/* Fill in the buffer IFC->IFC_BUF of length IFC->IFC_LEN with a list + of ifr structures, one for each network interface. */ +static int +siocgifconf (int fd, int request, struct ifconf *ifc) +{ + error_t err; + int data_len = ifc->ifc_len; + char *data = ifc->ifc_buf; + + if (data_len <= 0) + return 0; + + err = HURD_DPORT_USE (fd, __pfinet_siocgifconf (port, ifc->ifc_len, + &data, &data_len)); + if (data_len < ifc->ifc_len) + ifc->ifc_len = data_len; + if (data != ifc->ifc_buf) + { + memcpy (ifc->ifc_buf, data, ifc->ifc_len); + __vm_deallocate (__mach_task_self (), (vm_address_t) data, data_len); + } + return err ? __hurd_dfail (fd, err) : 0; +} +_HURD_HANDLE_IOCTL (siocgifconf, SIOCGIFCONF); |