This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Using <linux/stat.h> for _GNU_SOURCE
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 6 Nov 2017 15:58:15 +0000
- Subject: Re: Using <linux/stat.h> for _GNU_SOURCE
- Authentication-results: sourceware.org; auth=none
- References: <1bb8edae-fd3b-35ae-f572-a59bf8dbc45b@redhat.com>
On Mon, 6 Nov 2017, Florian Weimer wrote:
> Would it be possible to include <linux/stat.h> (not <asm/stat.h>) from
> <sys/stat.h> for _GNU_SOURCE? We'd need to add redefinition guards for the
> S_* macros defined in <linux/stat.h>, but otherwise, the header looks quite
> clean.
S_* appear to have conditionals
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
in <linux/stat.h>, so I don't think any guards are needed.
> This would allow us to obtain the STX_* constants and struct statx from the
> uapi header, without maintaining our own copy of that information. Or wouldn't
Note that if you start using any such constants and types in glibc such
that they need to be available when glibc is built, that would imply a
major change in the minimum supported kernel headers version for building
glibc (as opposed to the minimum kernel version supported at runtime, so
less problematic), from 3.2 to 4.11.
--
Joseph S. Myers
joseph@codesourcery.com