diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-10-29 21:40:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-10-29 21:40:21 +0000 |
commit | f720d3d2120ebb9a87af7c10e0939fb9dfee20ef (patch) | |
tree | 9f62a2e35e2bad276ff45b81c3769d694ca344ed /sysdeps/unix | |
parent | 26d63253e1e4bb2f9c22fdd75b1bcfaafe5d0324 (diff) | |
download | glibc-f720d3d2120ebb9a87af7c10e0939fb9dfee20ef.tar.gz glibc-f720d3d2120ebb9a87af7c10e0939fb9dfee20ef.tar.xz glibc-f720d3d2120ebb9a87af7c10e0939fb9dfee20ef.zip |
Update.
1999-10-27 Andreas Jaeger <aj@suse.de> * sysdeps/generic/ifreq.h: New file. * resolv/res_hconf.c: Add missing includes to get all prototypes. (_res_hconf_reorder_addrs): Rewrite. This never worked before. Reported by John DiMarco <jdd@cs.toronto.edu>. (_res_hconf_reorder_addrs): Made thread safe. (free_mem): New function, needed for malloc debugging. 1999-10-29 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/if_index.c (opensock): Move function to ... * sysdeps/generic/opensock.c (__opensock): ...here in a new file. * sysdeps/unix/sysv/linux/if_index.c: Change all callers of opensock to use __opensock. * socket/Makefile (routines): Add opensock. * include/sys/socket.h (__opensock): Add prototype declaration.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/if_index.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 58fb1648f2..44d310befe 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -35,47 +35,6 @@ static int old_siocgifconf; # define old_siocgifconf 0 #endif -/* Try to get a socket to talk to the kernel. */ -#if defined SIOCGIFINDEX || defined SIOCGIFNAME -static int -internal_function -opensock (void) -{ - /* Cache the last AF that worked, to avoid many redundant calls to - socket(). */ - static int sock_af = -1; - int fd = -1; - __libc_lock_define_initialized (static, lock); - - if (sock_af != -1) - { - fd = __socket (sock_af, SOCK_DGRAM, 0); - if (fd != -1) - return fd; - } - - __libc_lock_lock (lock); - - if (sock_af != -1) - fd = __socket (sock_af, SOCK_DGRAM, 0); - - if (fd == -1) - { - fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0); - if (fd < 0) - fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0); - if (fd < 0) - fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0); - if (fd < 0) - fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0); - if (fd < 0) - fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0); - } - - __libc_lock_unlock (lock); - return fd; -} -#endif unsigned int if_nametoindex (const char *ifname) @@ -85,7 +44,7 @@ if_nametoindex (const char *ifname) return 0; #else struct ifreq ifr; - int fd = opensock (); + int fd = __opensock (); if (fd < 0) return 0; @@ -124,7 +83,7 @@ if_nameindex (void) __set_errno (ENOSYS); return NULL; #else - int fd = opensock (); + int fd = __opensock (); struct ifconf ifc; unsigned int nifs, i; int rq_len; @@ -235,7 +194,7 @@ if_indextoname (unsigned int ifindex, char *ifname) # endif int status; - fd = opensock (); + fd = __opensock (); if (fd < 0) return NULL; @@ -285,7 +244,7 @@ void internal_function __protocol_available (int *have_inet, int *have_inet6) { - int fd = opensock (); + int fd = __opensock (); unsigned int nifs; int rq_len; struct ifconf ifc; |