This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] <sys/stat.h>: Use Linux kernel UAPI header if available and useful
* Andreas Schwab:
> On Jun 11 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> * Andreas Schwab:
>>
>>> On Jun 11 2019, Florian Weimer <fweimer@redhat.com> wrote:
>>>
>>>> Alternative, we could compile statx_generic separately and directly
>>>> include <io/bits/statx-generic.h>, bypassing the sysdeps search path.
>>>> But that means we cannot include <sys/stat.h>, but we need it for the
>>>> AT_* constants.
>>>
>>> If struct statx is put in a separate file it can be included twice, with
>>> arrangment for defining, say, struct statx_internal the second time.
>>
>> You mean like this?
>>
>> #include <sys/stat.h>
>> /* Change the tag of the struct definition. */
>> #define statx statx_original
>> #include <bits/types/struct_statx.h>
>> #undef statx
>>
>> I still consider this a preprocessor hack.
>
> It is only needed as long as the fallback is needed.
Sure, except that the fallback is also used on Hurd, so I assume that
code is here to stay.
>> I would prefer the static assert to this.
>
> In any case, the assertion is in the wrong place, since only the
> fallback needs it.
Only on Linux, we potentially compile against an out-of-tree definition
of struct statx, so this is why I added the assert there.
I can see arguments for adding it to either file.
If you want, I can repost the patch with the assert, this time moved to
io/statx_generic.c.
Thanks,
Florian