From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by sourceware.org (Postfix) with ESMTPS id 9AF803858D37 for ; Tue, 23 May 2023 13:31:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9AF803858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-5619032c026so94142227b3.1 for ; Tue, 23 May 2023 06:31:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684848695; x=1687440695; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RyXSRwIO/Pq7rng8oCji8QdfrTMVp3vzJTYHVRcF/Iw=; b=UcCRVBpiF/K9stMuUomUDwuiBMOPRc4octlEX0110dsDNB1+ilVtPqFK8Jax90QByf Pvmrizh1pU/281xWl7okFwyfuO2YeNd37j0Wscb3iqkYlHnD8lmm9Ndy/ESF+yK+7imT QRrBwEgtBljoyazjZH3J/xSyaBJL65ouifpIJHHWd0C0j9mIIbRCfn+j+4rmNTPTvUyz e/Yt64uX5H9FsUPTjeTyXmqAifQRPdEZ5xwdXEKV+SgVM7cnq6Rmk1+2UkVHQAPa6VF6 7JEyzmYB7gB1rpBnuEWTEJUDJScN8Q/ViAJ3ysjcYlw4ezZG6/9h0kwfk5jjySU53fga RGNA== X-Gm-Message-State: AC+VfDziP8okWxwWNdCFjwhq99TjRXOd7OPR0st9iColNVawlGh4f7pK rgZIqxVC4vFytBWkpRSEKIIVdoAoLJIIig== X-Google-Smtp-Source: ACHHUZ6Js8WgoOUcqCeEYTzPl6x44QBRlNyNBVBfYBo1m499Ae0vNOn7OrpNDR1U62wdgboAPP/u3Q== X-Received: by 2002:a81:9c51:0:b0:55a:ec:6de4 with SMTP id n17-20020a819c51000000b0055a00ec6de4mr14072185ywa.10.1684848694898; Tue, 23 May 2023 06:31:34 -0700 (PDT) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id u185-20020a8147c2000000b005613fb70ab2sm2901419ywa.95.2023.05.23.06.31.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 06:31:34 -0700 (PDT) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-56187339d6eso94037597b3.2 for ; Tue, 23 May 2023 06:31:34 -0700 (PDT) X-Received: by 2002:a0d:d5d1:0:b0:54f:bb49:c3a2 with SMTP id x200-20020a0dd5d1000000b0054fbb49c3a2mr15470941ywd.28.1684848694342; Tue, 23 May 2023 06:31:34 -0700 (PDT) MIME-Version: 1.0 References: <20230523132749.1646124-1-adhemerval.zanella@linaro.org> <20230523132749.1646124-5-adhemerval.zanella@linaro.org> In-Reply-To: <20230523132749.1646124-5-adhemerval.zanella@linaro.org> From: Luca Boccassi Date: Tue, 23 May 2023 14:31:23 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 4/4] linux: Add pidfd_getpid To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Florian Weimer , Philip Withnall Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 23 May 2023 at 14:28, Adhemerval Zanella wrote: > > This interface allows to obtain the associated process ID from the > process file descriptor. It is done by parsing the procps fdinfo > information. Its prototype is: > > pid_t pidfd_getpid (int fd) > > It returns the associated pid or -1 in case of an error and sets the > errno accordingly. The possible errno values are those from open, > read, and close (used on procps parsing), along with: > > - EBADF if the FD is negative, does not have a PID associatedi, or > if the fdinfo fields contains a value larger than pid_t. > > - EREMOTE if the PID is in a separate namespace. > > - ESRCH if the process is already terminated. > > Checked on x86_64-linux-gnu on Linux 4.15 (no CLONE_PID or waitid > support), Linux 5.15 (only clone support), and Linux 5.19 (full > support including clone3). Acked-by: Luca Boccassi