From 7facfddd0d6f69c54be8b922305dbc0ac3d43909 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 26 Jun 2001 10:21:56 +0000 Subject: * hurd/Makefile (user-interfaces): Add pfinet. * hurd/hurdioctl.c: Include , and . (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 . 2001-06-26 Mark Kettenis * hurd/Makefile (user-interfaces): Add pfinet. * hurd/hurdioctl.c: Include , and . (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 . --- hurd/hurdioctl.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'hurd/hurdioctl.c') 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 +#include +#include + +/* 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); -- cgit 1.4.1