[PATCH v4] linux: Add openat2 (BZ 31664)
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Mon Aug 25 19:41:46 GMT 2025
On 25/08/25 16:22, Adhemerval Zanella Netto wrote:
>
>
> On 25/08/25 11:53, Paul Eggert wrote:
>> On 2025-08-21 10:28, Paul Eggert wrote:
>>> On 8/21/25 06:38, Adhemerval Zanella wrote:
>>>> +extern int openat2 (int __dfd, const char *__filename, struct open_how *__how,
>>>> + size_t __usize)
>>>> + __nonnull ((2, 3));
>>>
>>> The pointer arguments should be marked with __restrict, for the same reason similar syscalls mark them that way.
>>>
>>> The __how argument should be pointer to const.
>>
>> Oh, sorry, I contradicted myself. If __how is marked 'const' then '__restrict' should not be added, for the same reason syscalls like utimensat lack '__restrict' (all pointer args are pointer-to-const). So please just add 'const' and don't add '__restrict'.
>
> Alright, I have figure out this but thanks for confirm it.
So I double checked the Linux source and open_how is indeed not marked
as const. The current syscall implementation only operates over a
temporary object and never sync back the result back (with a
copy_struct_to_user).
So I am not sure if this is an overlook from kernel developers, or if
this was done intentionally to allow some extension to change the
input howto operation to also return information. The initial patch
(fddb5d430ad9fa91b49b1d34d0202ffe2fa0e179) is not explicit if some
future extension would allow it.
I am ccing Aleksa to give us some light whether the idea is to really
allow the syscall to extend the howto to eventually allow it kernel
to return information.
More information about the Libc-alpha
mailing list