RE: [PATCH] pidfd: add ioctl to retrieve pid info

From: David Laight
Date: Sun Oct 06 2024 - 15:19:47 EST


...
> It would make sense for security information to get a separate ioctl so
> that struct pidfd_info just return simple and fast information and the
> security stuff can include things such as seccomp, caps etc pp.

Which also means it is pointless having the two bitmasks.
They just complicate things unnecessarily.

What you might want to do is have the kernel return the size
of the structure it would fill in (probably as the first field).
Also have the kernel fill (probably with zeros) the end of the
user buffer it didn't write to.
The ioctl is then an IOR() one.

Mind you, if you dig into the history (possibly of SYSV and/or BSD)
you'll find a structure the kernel filled with the info 'ps' needs.
The text based code that Linux uses is probably more extensible.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)