From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id C0E06385783F for ; Tue, 16 May 2023 12:10:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0E06385783F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 915E721B71; Tue, 16 May 2023 12:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684239045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lriqBbZEaPcPwUgacEvBjKSjQU6jnii/s4t7stwD4Jk=; b=PlRAHvMV/yyLE0w/JDwK8ea0YKPG2M1mVD5vnqWzyZJtSEr5HI14PYPKZoqfAD2N7olIjt dsR8P/dcJ4CydA3+M7a88bRT6PIufdC9UqoweWyWTtulUvMwaTlmfmGInL5OWJHzaEN0r+ hwHLsuB3KWr0NeD0yl3ATo/dDX2WmuM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684239045; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lriqBbZEaPcPwUgacEvBjKSjQU6jnii/s4t7stwD4Jk=; b=KyV0yLo8a2yxmmwWpq5tIDdZSPCzUbIDiDxJIdzNYCgr/wOyXwbEvypOOAkiJRwkwtyLkk f9jQDfds+G2citCQ== Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 5F0F32C141; Tue, 16 May 2023 12:10:45 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id 51DEA4A04D3; Tue, 16 May 2023 14:10:45 +0200 (CEST) From: Andreas Schwab To: Adhemerval Zanella via Libc-alpha Cc: Luca Boccassi , Florian Weimer , Philip Withnall , Adhemerval Zanella Subject: Re: [PATCH v3 3/3] linux: Add pidfd_getpid In-Reply-To: <20230516114612.159103-4-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Tue, 16 May 2023 08:46:12 -0300") References: <20230516114612.159103-1-adhemerval.zanella@linaro.org> <20230516114612.159103-4-adhemerval.zanella@linaro.org> X-Yow: Four thousand different MAGNATES, MOGULS & NABOBS are romping in my gothic solarium!! Date: Tue, 16 May 2023 14:10:45 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 Mai 16 2023, Adhemerval Zanella via Libc-alpha wrote: > diff --git a/NEWS b/NEWS > index aaecdc1c5b..7334bb49e9 100644 > --- a/NEWS > +++ b/NEWS > @@ -47,6 +47,10 @@ Major new features: > return a process ID, it returns a file descriptor that can be used along > other pidfd functions. > > +* On Linux, the pidfd_getpid has been added. It allows to retrieve the the pidfd_getpid function > diff --git a/manual/process.texi b/manual/process.texi > index 93e0ab5fb7..25417dce0d 100644 > --- a/manual/process.texi > +++ b/manual/process.texi > @@ -33,6 +33,7 @@ primitive functions to do each step individually instead. > * Process Creation Concepts:: An overview of the hard way to do it. > * Process Identification:: How to get the process ID of a process. > * Creating a Process:: How to fork a child process. > +* Querying a Process:: How to query a child process. > * Executing a File:: How to make a process execute another program. > * Process Completion:: How to tell when a child process has completed. > * Process Completion Status:: How to interpret the status value > @@ -389,6 +390,37 @@ Acts as @code{_Fork}, where it does not invoke any callbacks registered with > > This function is specific to Linux. > > +@node Querying a Process > +@section Querying a Process > + > +The @code{pidfd_fork} function returned file descriptor can be used to query > +for process extra information. The file descriptor returned by the @code{pidfd_fork} function > +@deftypefun pid_t pidfd_getpid (int @var{fd}) > +@standards{GNU, sys/pidfd.h} > +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} > + > +The @code{pidfd_getpid} retrieves the process ID associated with process file The @code{pidfd_getpid} function > +If the operation fails, @code{pidfd_getpid} return a value of @code{-1} and the returns @code{-1} -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."