This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] <sys/stat.h>: Use Linux kernel UAPI header if available and useful


On Jun 06 2019, Florian Weimer <fweimer@redhat.com> wrote:

> * 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.

And why is that a problem?  Either the kernel knows about the flag and
happily fills the structure, or it will return an error.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]