diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/mach/hurd/if_index.c | 17 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/if_index.c | 24 |
2 files changed, 26 insertions, 15 deletions
diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c index 9d0ca62fa1..11d21146ae 100644 --- a/sysdeps/mach/hurd/if_index.c +++ b/sysdeps/mach/hurd/if_index.c @@ -29,7 +29,7 @@ /* Return the interface index corresponding to interface IFNAME. On error, return 0. */ unsigned int -if_nametoindex (const char *ifname) +__if_nametoindex (const char *ifname) { struct ifreq ifr; int fd = __opensock (); @@ -49,11 +49,13 @@ if_nametoindex (const char *ifname) __close (fd); return ifr.ifr_ifindex; } -libc_hidden_def (if_nametoindex) +libc_hidden_def (__if_nametoindex) +weak_alias (__if_nametoindex, if_nametoindex) +libc_hidden_weak (if_nametoindex) /* Free the structure IFN returned by if_nameindex. */ void -if_freenameindex (struct if_nameindex *ifn) +__if_freenameindex (struct if_nameindex *ifn) { struct if_nameindex *ptr = ifn; while (ptr->if_name || ptr->if_index) @@ -63,12 +65,13 @@ if_freenameindex (struct if_nameindex *ifn) } free (ifn); } +weak_alias (__if_freenameindex, if_freenameindex) /* Return an array of if_nameindex structures, one for each network interface present, plus one indicating the end of the array. On error, return NULL. */ struct if_nameindex * -if_nameindex (void) +__if_nameindex (void) { error_t err = 0; char data[2048]; @@ -148,12 +151,13 @@ if_nameindex (void) __set_errno (err); return idx; } +weak_alias (__if_nameindex, if_nameindex) /* Store the name of the interface corresponding to index IFINDEX in IFNAME (which has space for at least IFNAMSIZ characters). Return IFNAME, or NULL on error. */ char * -if_indextoname (unsigned int ifindex, char *ifname) +__if_indextoname (unsigned int ifindex, char *ifname) { struct ifreq ifr; int fd = __opensock (); @@ -175,7 +179,8 @@ if_indextoname (unsigned int ifindex, char *ifname) __close (fd); return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); } -libc_hidden_def (if_indextoname) +weak_alias (__if_indextoname, if_indextoname) +libc_hidden_weak (if_indextoname) #if 0 void diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 0fac763f9f..b0644f2f9d 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -31,7 +31,7 @@ unsigned int -if_nametoindex (const char *ifname) +__if_nametoindex (const char *ifname) { #ifndef SIOCGIFINDEX __set_errno (ENOSYS); @@ -56,11 +56,13 @@ if_nametoindex (const char *ifname) return ifr.ifr_ifindex; #endif } -libc_hidden_def (if_nametoindex) +libc_hidden_def (__if_nametoindex) +weak_alias (__if_nametoindex, if_nametoindex) +libc_hidden_weak (if_nametoindex) void -if_freenameindex (struct if_nameindex *ifn) +__if_freenameindex (struct if_nameindex *ifn) { struct if_nameindex *ptr = ifn; while (ptr->if_name || ptr->if_index) @@ -70,7 +72,9 @@ if_freenameindex (struct if_nameindex *ifn) } free (ifn); } -libc_hidden_def (if_freenameindex) +libc_hidden_def (__if_freenameindex) +weak_alias (__if_freenameindex, if_freenameindex) +libc_hidden_weak (if_freenameindex) static struct if_nameindex * @@ -162,7 +166,7 @@ if_nameindex_netlink (void) if (idx[nifs].if_name == NULL) { idx[nifs].if_index = 0; - if_freenameindex (idx); + __if_freenameindex (idx); idx = NULL; goto nomem; } @@ -189,7 +193,7 @@ if_nameindex_netlink (void) struct if_nameindex * -if_nameindex (void) +__if_nameindex (void) { #ifndef SIOCGIFINDEX __set_errno (ENOSYS); @@ -199,11 +203,12 @@ if_nameindex (void) return result; #endif } -libc_hidden_def (if_nameindex) +weak_alias (__if_nameindex, if_nameindex) +libc_hidden_weak (if_nameindex) char * -if_indextoname (unsigned int ifindex, char *ifname) +__if_indextoname (unsigned int ifindex, char *ifname) { /* We may be able to do the conversion directly, rather than searching a list. This ioctl is not present in kernels before version 2.1.50. */ @@ -232,4 +237,5 @@ if_indextoname (unsigned int ifindex, char *ifname) else return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); } -libc_hidden_def (if_indextoname) +weak_alias (__if_indextoname, if_indextoname) +libc_hidden_weak (if_indextoname) |