On 2019-05-16, Christian Brauner [off-list ref] wrote:
On Wed, May 15, 2019 at 10:45:06AM -0700, Daniel Colascione wrote:
quoted
On Wed, May 15, 2019 at 3:04 AM Christian Brauner [off-list ref] wrote:
quoted
+ if (pid <= 0)
+ return -EINVAL;
WDYT of defining pid == 0 to mean "open myself"?
I'm torn. It be a nice shortcut of course but pid being 0 is usually an
indicator for child processes. So unless the getpid() before
pidfd_open() is an issue I'd say let's leave it as is. If you really
want the shortcut might -1 be better?
I'd suggest not using negative numbers, and instead reserving them for
PIDTYPE_TGID if we ever want to have that in the future. IMHO, doing
pfd = pidfd_open(getpid(), 0);
is not the end of the world.
--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>