Re: [PATCH 1/7] tools/nolibc: also handle _llseek system call

From: Thomas Weißschuh

Date: Sat Apr 18 2026 - 07:57:02 EST


Apr 18, 2026 13:23:43 David Laight <david.laight.linux@xxxxxxxxx>:

> On Sat, 18 Apr 2026 12:19:56 +0200
> Thomas Weißschuh <linux@xxxxxxxxxxxxxx> wrote:
>
>> On some architectures the llseek system call contains a leading
>> underscore. Also check for that one and prefer it over the lseek system
>> call as it is necessary for 64-bit offset handling.
>>
> ...
>> +#if defined(__NR_llseek)
>> +   nr_llseek = __NR_llseek;
>> +#else
>> +   nr_llseek = __NR__llseek;
>> +#endif
>
> Is that test the right way around?
> The commit messages says prefer _llseek, but that seems to prefer llseek.

Yes. lseek is the ifdef case below.
Here we have _llseek and llseek.
lseek always exists, but may no handle 64 bit offsets.
Only one of llseek and _llseek exists
for one given architecture.

>> +
>> +   ret = __nolibc_syscall5(nr_llseek, fd, offset >> 32, (uint32_t)offset, &loff, whence);
>>     if (ret < 0)
>>         result = ret;
>>     else
>>