Bug#538372: [PATCH] net: Support inclusion of <linux/socket.h> before <sys/socket.h>
- To: Ben Hutchings <ben@decadent.org.uk>
- Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org, Manuel Prinz <manuel@debian.org>, 538372@bugs.debian.org
- Subject: Bug#538372: [PATCH] net: Support inclusion of <linux/socket.h> before <sys/socket.h>
- From: Bastian Blank <waldi@debian.org>
- Date: Sun, 4 Oct 2009 16:53:10 +0200
- Message-id: <[🔎] 20091004145310.GA14433@wavehammer.waldi.eu.org>
- Mail-followup-to: Bastian Blank <waldi@debian.org>, Ben Hutchings <ben@decadent.org.uk>, David Miller <davem@davemloft.net>, netdev@vger.kernel.org, Manuel Prinz <manuel@debian.org>, 538372@bugs.debian.org
- Reply-to: Bastian Blank <waldi@debian.org>, 538372@bugs.debian.org
- In-reply-to: <[🔎] 1254627764.2395.48.camel@localhost>
- References: <[🔎] 1254627764.2395.48.camel@localhost>
On Sun, Oct 04, 2009 at 04:42:44AM +0100, Ben Hutchings wrote:
> From: Bastian Blank <waldi@debian.org>
>
> The following user-space program fails to compile:
>
> #include <linux/socket.h>
> #include <sys/socket.h>
> int main() { return 0; }
>
> The reason is that <linux/socket.h> tests __GLIBC__ to decide whether it
> should define various structures and macros that are now defined for
> user-space by <sys/socket.h>, but __GLIBC__ is not defined if no libc
> headers have yet been included.
>
> It seems safe to drop support for libc 5 now.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Bastian Blank <waldi@debian.org>
> --- a/include/linux/socket.h
> +++ b/include/linux/socket.h
> @@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
> /* _SS_MAXSIZE value minus size of ss_family */
> } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
>
> -#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> +#ifdef __KERNEL__
>
> #include <asm/socket.h> /* arch-dependent defines */
> #include <linux/sockios.h> /* the SIOCxxx I/O controls */
> @@ -101,21 +101,6 @@ struct cmsghdr {
> ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
>
> /*
> - * This mess will go away with glibc
> - */
> -
> -#ifdef __KERNEL__
> -#define __KINLINE static inline
> -#elif defined(__GNUC__)
> -#define __KINLINE static __inline__
> -#elif defined(__cplusplus)
> -#define __KINLINE static inline
> -#else
> -#define __KINLINE static
> -#endif
> -
> -
> -/*
> * Get the next cmsg header
> *
> * PLEASE, do not touch this function. If you think, that it is
> @@ -128,7 +113,7 @@ struct cmsghdr {
> * ancillary object DATA. --ANK (980731)
> */
>
> -__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
> +static inline struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
> struct cmsghdr *__cmsg)
> {
> struct cmsghdr * __ptr;
> @@ -140,7 +125,7 @@ __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
> return __ptr;
> }
>
> -__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
> +static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
> {
> return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
> }
>
> --
> Ben Hutchings
> Always try to do things in chronological order;
> it's less confusing that way.
--
You're dead, Jim.
-- McCoy, "The Tholian Web", stardate unknown
Reply to: