From patchwork Sun Apr 9 20:08:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 19928 Received: (qmail 70772 invoked by alias); 9 Apr 2017 20:08:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 70760 invoked by uid 89); 9 Apr 2017 20:08:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=networks, coordinates, 1736, H*r:4.88 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] Coordinate if.h definitions for Linux and glibc (BZ #21367) Date: Sun, 9 Apr 2017 22:08:31 +0200 Message-Id: <20170409200831.12378-1-aurelien@aurel32.net> This commit coordinates the definition of structures and enum already defined the Linux kernel UAPI headers, following the procedure described on https://sourceware.org/glibc/wiki/Synchronizing_Headers. With this change, it is safe to include and in any order in a a userspace application. Note: this as been fixed in commit 4a91cb61bb995 on the Linux side. Changelog: [BZ #21367] * sysdeps/gnu/net/if.h: wrap IFF_* enums in ! __UAPI_DEF_IF_NET_DEVICE_FLAGS defines. (struct ifmap): Wrap in !__UAPI_DEF_IF_IFMAP defines. (struct ifreq): Wrap in !__UAPI_DEF_IF_IFREQ defines. (struct ifconf): Wrap in !__UAPI_DEF_IF_IFCONF defines. --- ChangeLog | 9 +++++++++ sysdeps/gnu/net/if.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index b72d52164e..7a150cf048 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-04-09 Aurelien Jarno + + [BZ #21367] + * sysdeps/gnu/net/if.h: wrap IFF_* enums in + ! __UAPI_DEF_IF_NET_DEVICE_FLAGS defines. + (struct ifmap): Wrap in !__UAPI_DEF_IF_IFMAP defines. + (struct ifreq): Wrap in !__UAPI_DEF_IF_IFREQ defines. + (struct ifconf): Wrap in !__UAPI_DEF_IF_IFCONF defines. + 2017-04-07 H.J. Lu * sysdeps/i386/fpu/fclrexcpt.c (__feclearexcept): Use diff --git a/sysdeps/gnu/net/if.h b/sysdeps/gnu/net/if.h index 0afce08238..19d41d3d3a 100644 --- a/sysdeps/gnu/net/if.h +++ b/sysdeps/gnu/net/if.h @@ -39,6 +39,7 @@ struct if_nameindex #ifdef __USE_MISC /* Standard interface flags. */ +#if !__UAPI_DEF_IF_NET_DEVICE_FLAGS enum { IFF_UP = 0x1, /* Interface is up. */ @@ -79,6 +80,7 @@ enum IFF_DYNAMIC = 0x8000 /* Dialup device with changing addresses. */ # define IFF_DYNAMIC IFF_DYNAMIC }; +#endif /* !__UAPI_DEF_IF_NET_DEVICE_FLAGS */ /* The ifaddr structure contains information about one address of an interface. They are maintained by the different address families, @@ -108,6 +110,7 @@ struct ifaddr handy for debugging things. The set side is fine for now and being very small might be worth keeping for clean configuration. */ +#if !__UAPI_DEF_IF_IFMAP struct ifmap { unsigned long int mem_start; @@ -118,11 +121,13 @@ struct ifmap unsigned char port; /* 3 bytes spare */ }; +#endif /* !__UAPI_DEF_IF_IFMAP */ /* Interface request structure used for socket ioctl's. All interface ioctl's must have parameter definitions which begin with ifr_name. The remainder may be interface specific. */ +#if !__UAPI_DEF_IF_IFREQ struct ifreq { # define IFHWADDRLEN 6 @@ -148,6 +153,8 @@ struct ifreq __caddr_t ifru_data; } ifr_ifru; }; +#endif /* !__UAPI_DEF_IF_IFREQ */ + # define ifr_name ifr_ifrn.ifrn_name /* interface name */ # define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ # define ifr_addr ifr_ifru.ifru_addr /* address */ @@ -173,6 +180,7 @@ struct ifreq configuration for machine (useful for programs which must know all networks accessible). */ +#if !__UAPI_DEF_IF_IFCONF struct ifconf { int ifc_len; /* Size of buffer. */ @@ -182,6 +190,7 @@ struct ifconf struct ifreq *ifcu_req; } ifc_ifcu; }; +#endif /* !__UAPI_DEF_IF_IFCONF */ # define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */ # define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */ # define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */