about summary refs log tree commit diff
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
parentda0debaa44d30e57e2949d4e90ca0d5c4dc9e69c (diff)
downloadglibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.tar.gz
glibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.tar.xz
glibc-7facfddd0d6f69c54be8b922305dbc0ac3d43909.zip
* 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>.
-rw-r--r--ChangeLog14
-rw-r--r--hurd/Makefile2
-rw-r--r--hurd/hurdioctl.c31
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h16
4 files changed, 56 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a9989ea38..ecff3a651e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+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>.
+
 2001-06-25  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/gnu/net/if.h: Correct _IOT_ifreq and add _IOT_ifreq_short
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);
diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index 21ecda863b..9882d45b3e 100644
--- a/sysdeps/mach/hurd/bits/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,96,97,98,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
@@ -229,8 +229,8 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 #define	SIOCSIFDSTADDR	_IOW('i', 14, struct ifreq)	/* set p-p address */
 #define	OSIOCGIFDSTADDR	_IOWR('i',15, struct ifreq)	/* get p-p address */
 #define	SIOCGIFDSTADDR	_IOWR('i',34, struct ifreq)	/* get p-p address */
-#define	SIOCSIFFLAGS	_IOW('i', 16, struct ifreq)	/* set ifnet flags */
-#define	SIOCGIFFLAGS	_IOWR('i',17, struct ifreq)	/* get ifnet flags */
+#define	SIOCSIFFLAGS	_IOW('i', 16, struct ifreq_short)/* set ifnet flags */
+#define	SIOCGIFFLAGS	_IOWR('i',17, struct ifreq_short)/* get ifnet flags */
 #define	OSIOCGIFBRDADDR	_IOWR('i',18, struct ifreq)	/* get broadcast addr */
 #define	SIOCGIFBRDADDR	_IOWR('i',35, struct ifreq)	/* get broadcast addr */
 #define	SIOCSIFBRDADDR	_IOW('i',19, struct ifreq)	/* set broadcast addr */
@@ -239,8 +239,8 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 #define	OSIOCGIFNETMASK	_IOWR('i',21, struct ifreq)	/* get net addr mask */
 #define	SIOCGIFNETMASK	_IOWR('i',37, struct ifreq)	/* get net addr mask */
 #define	SIOCSIFNETMASK	_IOW('i',22, struct ifreq)	/* set net addr mask */
-#define	SIOCGIFMETRIC	_IOWR('i',23, struct ifreq)	/* get IF metric */
-#define	SIOCSIFMETRIC	_IOW('i',24, struct ifreq)	/* set IF metric */
+#define	SIOCGIFMETRIC	_IOWR('i',23, struct ifreq_int)	/* get IF metric */
+#define	SIOCSIFMETRIC	_IOW('i',24, struct ifreq_int)	/* set IF metric */
 #define	SIOCDIFADDR	_IOW('i',25, struct ifreq)	/* delete IF addr */
 #define	SIOCAIFADDR	_IOW('i',26, struct ifaliasreq)	/* add/chg IF alias */
 
@@ -249,6 +249,12 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 #define	SIOCGARP	_IOWR('i',38, struct arpreq)	/* get arp entry */
 #define	SIOCDARP	_IOW('i', 32, struct arpreq)	/* delete arp entry */
 
+#define SIOCGIFMTU	_IOWR('i', 51, struct ifreq_int)/* get IF mtu */
+#define SIOCSIFMTU	_IOW('i', 52, struct ifreq_int)	/* set IF mtu */
+
+#define SIOCGIFINDEX	_IOWR('i', 90, struct ifreq_int)/* get IF index */
+#define SIOCGIFNAME	_IOWR('i', 91, struct ifreq_int)/* set IF name */
+
 
 /* Compatibility with 4.3 BSD terminal driver.
    From 4.4 <sys/ioctl_compat.h>.  */