Hide internal __ifreq function [BZ #18822]

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.
This commit is contained in:
H.J. Lu 2017-10-01 17:35:26 -07:00
parent 43b7dfd1b6
commit b4744101f3
4 changed files with 23 additions and 24 deletions

View File

@ -1,3 +1,12 @@
2017-10-01 H.J. Lu <hongjiu.lu@intel.com>
[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.
2017-10-01 H.J. Lu <hongjiu.lu@intel.com> 2017-10-01 H.J. Lu <hongjiu.lu@intel.com>
[BZ #18822] [BZ #18822]

14
include/ifreq.h Normal file
View File

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

View File

@ -23,18 +23,6 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.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 static inline void
__if_freereq (struct ifreq *ifreqs, int num_ifs) __if_freereq (struct ifreq *ifreqs, int num_ifs)

View File

@ -24,18 +24,6 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.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 static inline void
__if_freereq (struct ifreq *ifreqs, int num_ifs) __if_freereq (struct ifreq *ifreqs, int num_ifs)