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 06 2019, Florian Weimer <fweimer@redhat.com> wrote:
>
>> diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c
>> index b99e30dc3e..5d634960a6 100644
>> --- a/sysdeps/unix/sysv/linux/statx.c
>> +++ b/sysdeps/unix/sysv/linux/statx.c
>> @@ -21,6 +21,11 @@
>>
>> #include "statx_generic.c"
>>
>> +/* Ensure that the kernel headers have not changed the struct size.
>> + If this ever happens, it may be necessary to introduce a new symbol
>> + version. */
>> +_Static_assert (sizeof (struct statx) == 256, "struct statx size changed");
>
> Why is that needed? Isn't the point of statx that only the known parts
> are filled?
There have been some discussions that future kernel versions might add
additional fields to the struct, outside the padding. Userspace would
request that by setting an additional flag.
I'm not sure if this will ever happen, but I thin it's reasonable to
check using this flag.
Thanks,
Florian