[PATCH v4] linux: Add openat2 (BZ 31664)
Florian Weimer
fweimer@redhat.com
Tue Aug 26 14:44:21 GMT 2025
* Paul Eggert:
> On 2025-08-26 06:03, Aleksa Sarai wrote:
>> Is removing const something we can do safely? I was under the impression
>> removing const from a function prototype can break building working
>> programs? (Even if they wouldn't be using the feature.)
>
> How so? Can you give a sample call that would break?
Starting with GCC 14, the last two lines are reported as containing
errors:
void f(char *);
void fc(const char *);
void (*pf)(const char *) = f;
void (*pfc)(char *) = fc;
>> But there is precedent for the CHECK_FIELDS approach
>> -- sched_setattr(2) and perf_event_open(2) both write to the size field
>
> None of these are in glibc. And this is a confusing design. And there
> is no good performance reason for it. Syscalls should instead use the
> POSIX standard model of sigaction etc.
I don't think sigaction is a good example because it is not extensible.
POSIX examples for extensible interfaces are posix_spawn and
pthread_attr_t, where each attribute ends up with two functions. That
approach isn't great, either.
> The glibc API can have two arguments even if the Linux syscall is
> poorly designed and has just one.
If we don't pass through the system call interface unchanged, past
experience tells us that this causes problems in the future.
Thanks,
Florian
More information about the Libc-alpha
mailing list