From 6d2039ee6b8de23d47be95bc18d3b3ba3f75c0df Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Wed, 20 Jan 2016 22:14:49 -0500 Subject: [PATCH] libc-compat.h: Set definitions only if __KERNEL__ is undefined Rather than check if __GLIBC__ is defined, this uses a different method of checking if the structs, etc. can be defined by instead checking for a lack of __KERNEL__ being defined. Since __KERNEL__ is defined in kernel things, we can use this check for the same effect as #ifdef __GLIBC__, without having to put a dependency on the libc being used defining it, as is the case with non-glibc libraries. This patch was originally authored by David Heidelberger , who I got permission from to resubmit adapted for any changes since the time he submitted them. Original patch: https://lkml.org/lkml/2014/3/14/274 --- include/uapi/linux/libc-compat.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index 7d024ce..cf92f97 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -48,8 +48,8 @@ #ifndef _UAPI_LIBC_COMPAT_H #define _UAPI_LIBC_COMPAT_H -/* We have included glibc headers... */ -#if defined(__GLIBC__) +/* We're used from userspace, */ +#ifndef __KERNEL__ /* Coordinate with glibc netinet/in.h header. */ #if defined(_NETINET_IN_H) @@ -115,7 +115,7 @@ /* If we did not see any headers from any supported C libraries, * or we are being included in the kernel, then define everything * that we need. */ -#else /* !defined(__GLIBC__) */ +#else /* __KERNEL__ */ /* Definitions for in.h */ #define __UAPI_DEF_IN_ADDR 1 @@ -138,6 +138,6 @@ /* Definitions for xattr.h */ #define __UAPI_DEF_XATTR 1 -#endif /* __GLIBC__ */ +#endif /* __KERNEL__ */ #endif /* _UAPI_LIBC_COMPAT_H */