Re: proposed libc interface and man page for statmount(2)

Florian Weimer
2023-11-16T20:36:42Z

* Miklos Szeredi:

> Hi,
>
> Attaching the proposed man page for the new statmount() syscall.
>
> It describes a libc interface that is slightly different from the raw
> kernel API. The differences from the two API's are also described in
> the man page.
>
> Raw:
>
> long syscall(SYS_statmount, const struct mnt_id_req *req,
> struct statmount *buf, size_t bufsize, unsigned int flags);
>
> Libc:
>
> struct statmount *statmount(uint64_t mnt_id, uint64_t request_mask,
> struct statmount *buf, size_t bufsize,
> unsigned int flags);
>
> I propose the libc one to allow automatically allocating the buffer if
> the buf argument is NULL, similar to getcwd(3).

In addition to Adhemerval's observation that we'd prefer to have some
hint regarding the buffer size, it's probably better to have entirely
separate interfaces because it makes static analysis easier. With a
unified interface, we can still convey the information with an inline
wrapper function, but we can avoid that complexity.

Thanks,
Florian