diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-05-14 14:11:02 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-05-14 14:11:02 +0000 |
commit | ffb7875d03e224584fd1e3dc8bb6e90c79ed606e (patch) | |
tree | 7735bbae8f840773afe241281ae1184cd956acc8 /sysdeps/unix/sysv/linux/ifreq.c | |
parent | 1bfb72913bf82781ae232d056991362b2b071800 (diff) | |
download | glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.tar.gz glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.tar.xz glibc-ffb7875d03e224584fd1e3dc8bb6e90c79ed606e.zip |
Remove pre-2.2 Linux kernel support.
Diffstat (limited to 'sysdeps/unix/sysv/linux/ifreq.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/ifreq.c | 57 |
1 files changed, 16 insertions, 41 deletions
diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c index bd0d17e5d5..551af725b0 100644 --- a/sysdeps/unix/sysv/linux/ifreq.c +++ b/sysdeps/unix/sysv/linux/ifreq.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999,2002,2003,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -19,13 +19,6 @@ #include "ifreq.h" #include <kernel-features.h> -/* Variable to signal whether SIOCGIFCONF is not available. */ -#if __ASSUME_SIOCGIFNAME == 0 || 1 -static int old_siocgifconf; -#else -# define old_siocgifconf 0 -#endif - void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) @@ -49,45 +42,27 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) /* We may be able to get the needed buffer size directly, rather than guessing. */ - if (! old_siocgifconf) - { - ifc.ifc_buf = NULL; - ifc.ifc_len = 0; - if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) - { -# if __ASSUME_SIOCGIFNAME == 0 - old_siocgifconf = 1; -# endif - rq_len = RQ_IFS * sizeof (struct ifreq); - } - else - rq_len = ifc.ifc_len; - } - else + ifc.ifc_buf = NULL; + ifc.ifc_len = 0; + if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) rq_len = RQ_IFS * sizeof (struct ifreq); + else + rq_len = ifc.ifc_len; /* Read all the interfaces out of the kernel. */ - while (1) + ifc.ifc_len = rq_len; + void *newp = realloc (ifc.ifc_buf, ifc.ifc_len); + if (newp == NULL + || (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0) { - ifc.ifc_len = rq_len; - void *newp = realloc (ifc.ifc_buf, ifc.ifc_len); - if (newp == NULL - || (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0) - { - free (ifc.ifc_buf); + free (ifc.ifc_buf); - if (fd != sockfd) - __close (fd); + if (fd != sockfd) + __close (fd); - *num_ifs = 0; - *ifreqs = NULL; - return; - } - - if (!old_siocgifconf || ifc.ifc_len < rq_len) - break; - - rq_len *= 2; + *num_ifs = 0; + *ifreqs = NULL; + return; } nifs = ifc.ifc_len / sizeof (struct ifreq); |