Re: [PATCH 1/2] pid: add pidfd_open()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Christian Brauner <christian@xxxxxxxxxx>
- Subject: Re: [PATCH 1/2] pid: add pidfd_open()
- From: Aleksa Sarai <cyphar@xxxxxxxxxx>
- Date: Fri, 17 May 2019 00:53:41 +1000
- Cc: Daniel Colascione <dancol@xxxxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, Oleg Nesterov <oleg@xxxxxxxxxx>, Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, linux-kernel <linux-kernel@xxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, David Howells <dhowells@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>, elena.reshetova@xxxxxxxxx, Kees Cook <keescook@xxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, Linux API <linux-api@xxxxxxxxxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, "open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@xxxxxxxxxxxxxxx>
- In-reply-to: <20190516130813.i66ujfzftbgpqhnh@brauner.io>
- References: <20190515100400.3450-1-christian@brauner.io> <CAKOZuesPF+ftwqsNDMBy1LpwJgWTNuQm9-E=C90sSTBYEEsDww@mail.gmail.com> <20190516130813.i66ujfzftbgpqhnh@brauner.io>
On 2019-05-16, Christian Brauner <christian@xxxxxxxxxx> wrote:
> On Wed, May 15, 2019 at 10:45:06AM -0700, Daniel Colascione wrote:
> > On Wed, May 15, 2019 at 3:04 AM Christian Brauner <christian@xxxxxxxxxx> wrote:
> > > + 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/>
Attachment:
signature.asc
Description: PGP signature
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]