public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Luca Boccassi <luca.boccassi@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2 3/3] linux: Add pidfd_getpid
Date: Thu, 20 Apr 2023 15:24:48 +0100	[thread overview]
Message-ID: <CAMw=ZnSPBZGFLXK1kGRv9YMr=EzWSOkoXR0i7dmDCtRggJVSLw@mail.gmail.com> (raw)
In-Reply-To: <20230420142037.4063169-4-adhemerval.zanella@linaro.org>

On Thu, 20 Apr 2023 at 15:20, Adhemerval Zanella
<adhemerval.zanella@linaro.org> 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 <bluca@debian.org>

  reply	other threads:[~2023-04-20 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 14:20 [PATCH v2 0/3] Add pidfd_spawn, pidfd_spawnp, pidfd_fork, and pidfd_getpid Adhemerval Zanella
2023-04-20 14:20 ` [PATCH v2 1/3] posix: Add pidfd_spawn and pidfd_spawnp (BZ# 30349) Adhemerval Zanella
2023-04-20 14:20 ` [PATCH v2 2/3] posix: Add pidfd_fork Adhemerval Zanella
2023-04-20 14:20 ` [PATCH v2 3/3] linux: Add pidfd_getpid Adhemerval Zanella
2023-04-20 14:24   ` Luca Boccassi [this message]
2023-05-02 16:07   ` Florian Weimer
2023-05-02 16:19     ` Luca Boccassi
2023-05-02 17:13       ` Florian Weimer
2023-05-15 17:39     ` Adhemerval Zanella Netto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMw=ZnSPBZGFLXK1kGRv9YMr=EzWSOkoXR0i7dmDCtRggJVSLw@mail.gmail.com' \
    --to=luca.boccassi@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).