1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Remove pre-2.2 Linux kernel support.

This commit is contained in:
Joseph Myers
2012-05-14 14:11:02 +00:00
parent 1bfb72913b
commit ffb7875d03
40 changed files with 333 additions and 1447 deletions

View File

@ -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);