mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH v2] Add additional uapi guards for Linux kernel header files
Date: Tue, 9 Jan 2018 12:15:25 -0500	[thread overview]
Message-ID: <20180109171525.GX1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <20180106223252.3904-1-hauke@hauke-m.de>

On Sat, Jan 06, 2018 at 11:32:52PM +0100, Hauke Mehrtens wrote:
> With Linux kernel 4.16 it will be possible to guard more parts of the
> Linux header files from a libc. Make use of this in musl to guard all
> the structures and other definitions from the Linux header files which
> are also defined by the header files provided by musl. This will make
> musl compile with the unmodified Linux kernel user space headers.
> 
> This extends the definitions done in commit 04983f227238 ("make
> netinet/in.h suppress clashing definitions from kernel headers")
> 
> The needed patches were recently accepted into the netdev tree and will be integrated in Linux 4.16:
> https://patchwork.ozlabs.org/patch/854342/
> https://patchwork.ozlabs.org/patch/855293/

I think this looks ok but I'm going to make a couple minor corrections
to the message and patch when merging it. "make musl compile with the
unmodified..." does not make sense because musl does not use kernel
headers at all. What the patch does is make it possible to compile
applications that include both the musl and Linux headers (if the libc
ones come first). Also alignment should be done with spaces not tabs
(not assuming any particular tab width). There are probably some
places this is wrong in musl's headers now but I don't want to keep
adding more.

Rich


> ---
>  include/net/if.h           | 7 +++++++
>  include/netinet/if_ether.h | 1 +
>  include/sys/xattr.h        | 2 ++
>  3 files changed, 10 insertions(+)
> 
> diff --git a/include/net/if.h b/include/net/if.h
> index 2f2fcc10..0ee48cd7 100644
> --- a/include/net/if.h
> +++ b/include/net/if.h
> @@ -125,6 +125,13 @@ struct ifconf {
>  #define ifc_req		ifc_ifcu.ifcu_req
>  #define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
>  
> +#define __UAPI_DEF_IF_IFCONF					0
> +#define __UAPI_DEF_IF_IFMAP					0
> +#define __UAPI_DEF_IF_IFNAMSIZ					0
> +#define __UAPI_DEF_IF_IFREQ					0
> +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS				0
> +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO	0
> +
>  #endif
>  
>  #ifdef __cplusplus
> diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
> index d9a131aa..c2c6e944 100644
> --- a/include/netinet/if_ether.h
> +++ b/include/netinet/if_ether.h
> @@ -133,5 +133,6 @@ do { \
>  	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
>  } while(0)
>  
> +#define __UAPI_DEF_ETHHDR	0
>  
>  #endif
> diff --git a/include/sys/xattr.h b/include/sys/xattr.h
> index 6479fcc6..52e3dd89 100644
> --- a/include/sys/xattr.h
> +++ b/include/sys/xattr.h
> @@ -24,6 +24,8 @@ int removexattr(const char *, const char *);
>  int lremovexattr(const char *, const char *);
>  int fremovexattr(int, const char *);
>  
> +#define __UAPI_DEF_XATTR	0
> +
>  #ifdef __cplusplus
>  }
>  #endif
> -- 
> 2.11.0


  reply	other threads:[~2018-01-09 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-06 22:32 Hauke Mehrtens
2018-01-09 17:15 ` Rich Felker [this message]
2018-01-10 11:35 ` Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180109171525.GX1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).