From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by sourceware.org (Postfix) with ESMTPS id 74FB03858D37 for ; Thu, 20 Apr 2023 14:25:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74FB03858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-54fe3cd445aso44200157b3.5 for ; Thu, 20 Apr 2023 07:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682000700; x=1684592700; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6D5J2DXy15NOIs2VQRUwuhFTKjweH73HTAn3/OMvvGs=; b=ZzvGE6cqI6C3p+TFzxiQX8sheI7zoBdOzFg2sq8tWPj02b423RqApwI7U4iBCNOAs9 vhGc0KL13MX+9FBzJBzh1I2VURMx0ec6+ucswwyvcFAcqhKc+06o2kQsPW6GPGVZ2fMo tdm/QA92tmd3JtEchEc9OaIIJYA6l/JIfLf37/YJznSU2MVhwGKZm50yc8mNYMOH2xL0 Or2jpb9568zCHzuCwSp0bAYb10R4AVHpu32Pl0jfiA+DmjVaBOp4eA6e5hgAt9+Dxqvr Hj8zinBKu5DyCFrmXSSlf/wg52STQvFSOZr1fMDJ9swjQYS3t9Tx1jPLpIIuQ4hl0U38 QoRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682000700; x=1684592700; 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=6D5J2DXy15NOIs2VQRUwuhFTKjweH73HTAn3/OMvvGs=; b=l8Aqclol6t4ye/cLwHSTSHRoQfoprmPbNykwBXmhMCA4LvBvAEEJMoGwT92O5Z01yL FdXMSDkY2xQTCuCtkOayyItYRwhwkyj47XuAtmtu5B5z4Jol16x0yQfCEgBGaHEocPWV 0cj5NbNGo2zUG2eDmtQx2XmSX4Wp5lLxRdcVyGAMyB0fOqEfN/OkM7PUTf1xT6E2mTxv xEqiF76KvmCNplhzFfTymy5kX7ilUNGsN090+KhkNAQEICv4Ln5byvHJOLYv6Ma9zEcN rjJWLxUvPYlYTEo+hfkvHlxAm60dnclqBQkHBtdV5jWY9rYTMGNXwG7j56ZmiDrFj8Au ZDwg== X-Gm-Message-State: AAQBX9eUVrP+7jsvlFEKam+FUFOG2nWVWkYTrin35sDp6yu+tUEym88D pmQJgFxTShRMcXrXL1j2yQFEPH248ZkFXWXAcAPL1Rgi X-Google-Smtp-Source: AKy350YYDiDC6ulnwwoptKgjCnjNrhiMXhTEznu7RbzwhfsiFU0rvWfpR1XUu7h2qgk1EeY91oJWqB9ZZl6n2BNNU/8= X-Received: by 2002:a81:a084:0:b0:552:a147:c50b with SMTP id x126-20020a81a084000000b00552a147c50bmr1165083ywg.23.1682000699371; Thu, 20 Apr 2023 07:24:59 -0700 (PDT) MIME-Version: 1.0 References: <20230420142037.4063169-1-adhemerval.zanella@linaro.org> <20230420142037.4063169-4-adhemerval.zanella@linaro.org> In-Reply-To: <20230420142037.4063169-4-adhemerval.zanella@linaro.org> From: Luca Boccassi Date: Thu, 20 Apr 2023 15:24:48 +0100 Message-ID: Subject: Re: [PATCH v2 3/3] linux: Add pidfd_getpid To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, 20 Apr 2023 at 15:20, Adhemerval Zanella wrote: > > This interface allows to obtain the associated pid 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 set the > errno accordingly. The possible errno values are the smae from > open, read, and close (used on procps parsing), along with: > > - EINVAL if the FP is negative (similar to fexecve). > > - EBADF if the FD does not have a PID associated of 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