From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD191C433E6 for ; Tue, 1 Sep 2020 16:33:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A23832065F for ; Tue, 1 Sep 2020 16:33:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730756AbgIAQdP (ORCPT ); Tue, 1 Sep 2020 12:33:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54450 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727950AbgIAQdL (ORCPT ); Tue, 1 Sep 2020 12:33:11 -0400 Received: from ip5f5af70b.dynamic.kabel-deutschland.de ([95.90.247.11] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kD9DZ-00028h-7Q; Tue, 01 Sep 2020 16:33:09 +0000 Date: Tue, 1 Sep 2020 18:33:08 +0200 From: Christian Brauner To: Oleg Nesterov Cc: linux-kernel@vger.kernel.org, Christian Brauner , "Peter Zijlstra (Intel)" , Ingo Molnar , Thomas Gleixner , "Eric W. Biederman" , Kees Cook , Sargun Dhillon , Aleksa Sarai , linux-kselftest@vger.kernel.org, Josh Triplett , Jens Axboe , linux-api@vger.kernel.org Subject: Re: [PATCH 1/4] pidfd: support PIDFD_NONBLOCK in pidfd_open() Message-ID: <20200901163308.mwd334y462fmml6s@wittgenstein> References: <20200831134551.1599689-1-christian.brauner@ubuntu.com> <20200831134551.1599689-2-christian.brauner@ubuntu.com> <20200901162309.GB4386@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200901162309.GB4386@redhat.com> Sender: linux-api-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Tue, Sep 01, 2020 at 06:23:10PM +0200, Oleg Nesterov wrote: > On 08/31, Christian Brauner wrote: > > > > --- /dev/null > > +++ b/include/uapi/linux/pidfd.h > > @@ -0,0 +1,12 @@ > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > + > > +#ifndef _UAPI_LINUX_PIDFD_H > > +#define _UAPI_LINUX_PIDFD_H > > + > > +#include > > +#include > > + > > +/* Flags for pidfd_open(). */ > > +#define PIDFD_NONBLOCK O_NONBLOCK > > + > > +#endif /* _UAPI_LINUX_PIDFD_H */ > > Why? Can't we simply use O_NONBLOCK ? It's the same thing we seem to do for any other (anon inode) fds: include/linux/eventfd.h:#define EFD_NONBLOCK O_NONBLOCK include/uapi/linux/inotify.h:#define IN_NONBLOCK O_NONBLOCK include/uapi/linux/signalfd.h:#define SFD_NONBLOCK O_NONBLOCK include/uapi/linux/timerfd.h:#define TFD_NONBLOCK O_NONBLOCK also for O_CLOEXEC: include/linux/eventfd.h:#define EFD_CLOEXEC O_CLOEXEC include/linux/userfaultfd_k.h:#define UFFD_CLOEXEC O_CLOEXEC include/uapi/linux/eventpoll.h:#define EPOLL_CLOEXEC O_CLOEXEC include/uapi/linux/mount.h:#define OPEN_TREE_CLOEXEC O_CLOEXEC include/uapi/linux/perf_event.h:#define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ include/uapi/linux/signalfd.h:#define SFD_CLOEXEC O_CLOEXEC include/uapi/linux/timerfd.h:#define TFD_CLOEXEC O_CLOEXEC So I think we should just do the same. A clean flag namespace seems nicer to me too tbh. Christian