From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH 2/5] pidfd: add pidfd_wait() Date: Thu, 25 Jul 2019 09:34:28 -0500 Message-ID: <87zhl2uqrv.fsf@xmission.com> References: <20190724144651.28272-1-christian@brauner.io> <20190724144651.28272-3-christian@brauner.io> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Linus Torvalds's message of "Wed, 24 Jul 2019 10:45:38 -0700") Sender: linux-kernel-owner@vger.kernel.org To: Linus Torvalds Cc: Christian Brauner , Linux List Kernel Mailing , Oleg Nesterov , Arnd Bergmann , Kees Cook , Joel Fernandes , Thomas Gleixner , Tejun Heo , David Howells , Jann Horn , Andrew Lutomirski , Andrew Morton , Aleksa Sarai , Al Viro , Android Kernel Team , Linux API List-Id: linux-api@vger.kernel.org Linus Torvalds writes: > On Wed, Jul 24, 2019 at 7:47 AM Christian Brauner wrote: >> >> This adds the pidfd_wait() syscall. > > I despise this patch. > > Why can't this just be a new P_PIDFD flag, and then use > "waitid(P_PIDFD, pidfd, ...);" > > Yes, yes, yes, I realize that "pidfd" is of type "int", and waitid() > takes an argument of type pid_t, but it's the same type in the end, > and it does seem like the whole *point* of "waitid()" is that > "idtype_t idtype" which tells you what kind of ID you're passing it. Just to emphasize this point. The posix declaration of waitid is: >int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); Where id_t is defined as: > id_t - Used as a general identifier; can be used to contain at least a pid_t, uid_t, or gid_t. And the BSDs at least have defined P_UID and P_GID. So that flexibility has been used. So it looks entirely reasonable to have P_PIDFD that just waits for a specified child. Eric