Thread (18 messages) 18 messages, 7 authors, 2019-05-16

Re: [PATCH 1/2] pid: add pidfd_open()

From: Aleksa Sarai <hidden>
Date: 2019-05-16 14:54:12
Also in: linux-alpha, linux-arch, linux-arm-kernel, linux-kselftest, linux-mips, linux-sh, linuxppc-dev, lkml, sparclinux

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/>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help