1 --- a/libc/inet/ifaddrs.c
2 +++ b/libc/inet/ifaddrs.c
6 #include "netlinkaccess.h"
9 libc_hidden_proto(socket)
10 libc_hidden_proto(close)
11 @@ -57,7 +58,6 @@ libc_hidden_proto(abort)
14 #if __ASSUME_NETLINK_SUPPORT
15 -#if 0 /* unused code */
16 /* struct to hold the data for one ifaddrs entry, so we can allocate
17 everything at once. */
18 struct ifaddrs_storage
19 @@ -74,8 +74,6 @@ struct ifaddrs_storage
20 } addr, netmask, broadaddr;
21 char name[IF_NAMESIZE + 1];
23 -#endif /* unused code */
27 __netlink_free_handle (struct netlink_handle *h)
28 @@ -323,8 +321,6 @@ __netlink_open (struct netlink_handle *h
33 -#if 0 /* unused code */
34 /* We know the number of RTM_NEWLINK entries, so we reserve the first
35 # of entries for this type. All RTM_NEWADDR entries have an index
36 pointer to the RTM_NEWLINK entry. To find the entry, create
37 @@ -562,7 +558,7 @@ getifaddrs (struct ifaddrs **ifap)
38 if ((rta_payload + 1) <= sizeof (ifas[ifa_index].name))
40 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
41 - *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
42 + *(char *) mempcpy (ifas[ifa_index].name, rta_data,
46 @@ -761,7 +757,7 @@ getifaddrs (struct ifaddrs **ifap)
47 if (rta_payload + 1 <= sizeof (ifas[ifa_index].name))
49 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name;
50 - *(char *) __mempcpy (ifas[ifa_index].name, rta_data,
51 + *(char *) mempcpy (ifas[ifa_index].name, rta_data,
55 @@ -872,6 +868,4 @@ freeifaddrs (struct ifaddrs *ifa)
59 -#endif /* unused code */
61 #endif /* __ASSUME_NETLINK_SUPPORT */
62 --- a/libc/inet/netlinkaccess.h
63 +++ b/libc/inet/netlinkaccess.h
64 @@ -61,14 +61,11 @@ struct netlink_handle
68 -#if 0 /* unused code */
69 #if __ASSUME_NETLINK_SUPPORT == 0
70 extern int __no_netlink_support attribute_hidden;
72 # define __no_netlink_support 0
74 -#endif /* unused code */
77 extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
78 extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
80 +++ b/include/ifaddrs.h
82 +/* ifaddrs.h -- declarations for getting network interface addresses
83 + Copyright (C) 2002 Free Software Foundation, Inc.
84 + This file is part of the GNU C Library.
86 + The GNU C Library is free software; you can redistribute it and/or
87 + modify it under the terms of the GNU Lesser General Public
88 + License as published by the Free Software Foundation; either
89 + version 2.1 of the License, or (at your option) any later version.
91 + The GNU C Library is distributed in the hope that it will be useful,
92 + but WITHOUT ANY WARRANTY; without even the implied warranty of
93 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94 + Lesser General Public License for more details.
96 + You should have received a copy of the GNU Lesser General Public
97 + License along with the GNU C Library; if not, write to the Free
98 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
102 +#define _IFADDRS_H 1
104 +#include <features.h>
105 +#include <sys/socket.h>
109 +/* The `getifaddrs' function generates a linked list of these structures.
110 + Each element of the list describes one network interface. */
113 + struct ifaddrs *ifa_next; /* Pointer to the next structure. */
115 + char *ifa_name; /* Name of this network interface. */
116 + unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */
118 + struct sockaddr *ifa_addr; /* Network address of this interface. */
119 + struct sockaddr *ifa_netmask; /* Netmask of this interface. */
122 + /* At most one of the following two is valid. If the IFF_BROADCAST
123 + bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the
124 + IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
125 + It is never the case that both these bits are set at once. */
126 + struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
127 + struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
129 + /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
130 + So if they are defined already, the existing definitions will be fine. */
131 +# ifndef ifa_broadaddr
132 +# define ifa_broadaddr ifa_ifu.ifu_broadaddr
134 +# ifndef ifa_dstaddr
135 +# define ifa_dstaddr ifa_ifu.ifu_dstaddr
138 + void *ifa_data; /* Address-specific data (may be unused). */
142 +/* Create a linked list of `struct ifaddrs' structures, one for each
143 + network interface on the host machine. If successful, store the
144 + list in *IFAP and return 0. On errors, return -1 and set `errno'.
146 + The storage returned in *IFAP is allocated dynamically and can
147 + only be properly freed by passing it to `freeifaddrs'. */
148 +extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
150 +/* Reclaim the storage allocated by a previous `getifaddrs' call. */
151 +extern void freeifaddrs (struct ifaddrs *__ifa) __THROW;
155 +#endif /* ifaddrs.h */