[42/58] Hide internal __ifreq function [BZ #18822]
Commit Message
Hide internal __ifreq function to allow direct access within libc.so and
libc.a without using GOT nor PLT.
[BZ #18822]
* include/ifreq.h: New file.
* sysdeps/generic/ifreq.h (__if_nextreq): Removed.
(__ifreq): Likewise.
* sysdeps/mach/hurd/ifreq.h (__if_nextreq): Removed.
(__ifreq): Likewise.
---
include/ifreq.h | 14 ++++++++++++++
sysdeps/generic/ifreq.h | 12 ------------
sysdeps/mach/hurd/ifreq.h | 12 ------------
3 files changed, 14 insertions(+), 24 deletions(-)
create mode 100644 include/ifreq.h
Comments
On 9/1/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> Hide internal __ifreq function to allow direct access within libc.so and
> libc.a without using GOT nor PLT.
>
> [BZ #18822]
> * include/ifreq.h: New file.
> * sysdeps/generic/ifreq.h (__if_nextreq): Removed.
> (__ifreq): Likewise.
> * sysdeps/mach/hurd/ifreq.h (__if_nextreq): Removed.
> (__ifreq): Likewise.
>
Tested with build-many-glibcs.py. I am checking it in.
new file mode 100644
@@ -0,0 +1,14 @@
+#include_next <ifreq.h>
+
+static inline struct ifreq *
+__if_nextreq (struct ifreq *ifr)
+{
+#ifdef _HAVE_SA_LEN
+ if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
+ return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
+#endif
+ return ifr + 1;
+}
+
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+ attribute_hidden;
@@ -23,18 +23,6 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-#ifdef _HAVE_SA_LEN
- if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
- return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
-#endif
- return ifr + 1;
-}
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
static inline void
__if_freereq (struct ifreq *ifreqs, int num_ifs)
@@ -24,18 +24,6 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-#ifdef _HAVE_SA_LEN
- if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
- return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
-#endif
- return ifr + 1;
-}
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
static inline void
__if_freereq (struct ifreq *ifreqs, int num_ifs)