Re: [PATCH] getdents.2: Use 'ssize_t' instead of 'int'

From: Alejandro Colomar
Date: Thu Oct 29 2020 - 07:02:52 EST


[[ CC += linux-kernel, libc-alpha ]]

Hi Michael,

On 2020-10-29 08:13, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
>
> On 10/28/20 11:11 PM, Alejandro Colomar wrote:
>> The glibc wrapper for getdents64() uses ssize_t.
>
> It also changed the types for the arguments, so those need to be
> fixed too.

I saw that, but I sent an email to glibc asking if it was a bug.
I'll hold this patch, and I'll CC this list in that other thread.

>
>> And let's use it also for getdents().
>
> I actually think we should *not* change that. So long as their is
> no wrapper, we should show pretty much what the ABI exposes. (That
> makes me think that the return type should really be long; see
> what you think about DEFINE_SYSCALL3 in the kernel sources.)

Agreed; then getdents() (and all syscalls without a wrapper)
should use 'long', as you said.

BTW: My mind explodes when I try to read through SYSCALL_DEFINEx :)

>
> And you added an include for <sys/types.h>. I'm not sure
> whether that's needed, but it should be explained in the
> commit message.

Agreed.
I should be able to check if it's needed, in ssize_t(3) :p
... Actually it's not needed (<stdio.h> already provides it).

Thanks,

Alex