aboutsummaryrefslogtreecommitdiff
path: root/hurd/hurdioctl.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-06-26 10:21:56 +0000
committerMark Kettenis <kettenis@gnu.org>2001-06-26 10:21:56 +0000
commit7facfddd0d6f69c54be8b922305dbc0ac3d43909 (patch)
tree0ab050115bb7dbe6c92f64dd9be92433779b434f /hurd/hurdioctl.c
parentda0debaa44d30e57e2949d4e90ca0d5c4dc9e69c (diff)
downloadglibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.zip
glibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.tar.gz
glibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.tar.bz2
* hurd/Makefile (user-interfaces): Add pfinet. * hurd/hurdioctl.c: Include <hurd/pfinet.h>, <net/if.h> and <netinet/in.h>. (siocgifconf): New function. Register it with HURD_HANDLE_IOCTL as the handler for SIOCGIFCONF. * sysdeps/mach/hurd/bits/ioctls.h: Modify SIOCSIFFLAGS and SIOCGIFFLAGS to be of IOC type ifreq_short. Modify SIOCSIFMETRIC and SIOCGIFMETRIC to be of IOC type ifreq_int. Add new macro definitions for SIOCGIFMTU, SIOCSIFMTU, SIOCGIFINDEX and SIOCGIFNAME. From Marcus Brunkmann <marcus@gnu.org>.
2001-06-26 Mark Kettenis <kettenis@gnu.org> * hurd/Makefile (user-interfaces): Add pfinet. * hurd/hurdioctl.c: Include <hurd/pfinet.h>, <net/if.h> and <netinet/in.h>. (siocgifconf): New function. Register it with HURD_HANDLE_IOCTL as the handler for SIOCGIFCONF. * sysdeps/mach/hurd/bits/ioctls.h: Modify SIOCSIFFLAGS and SIOCGIFFLAGS to be of IOC type ifreq_short. Modify SIOCSIFMETRIC and SIOCGIFMETRIC to be of IOC type ifreq_int. Add new macro definitions for SIOCGIFMTU, SIOCSIFMTU, SIOCGIFINDEX and SIOCGIFNAME. From Marcus Brunkmann <marcus@gnu.org>.
Diffstat (limited to 'hurd/hurdioctl.c')
-rw-r--r--hurd/hurdioctl.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c
index 073c15e..c4cb679 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);