Linux-man Archive on lore.kernel.org
 help / color / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org,
	jannh@google.com, oleg@redhat.com
Subject: Re: [PATCH] clone.2: add CLONE_PIDFD entry
Date: Thu, 19 Sep 2019 06:43:56 +0200
Message-ID: <91e5e4fe-e09e-7f9b-1a53-0bc31c63ddce@gmail.com> (raw)
In-Reply-To: <6a863c6a-3e61-f0b6-963e-a3545d9935d6@gmail.com>

Hello Christian,

A tweak to one point from my mail of a few minutes ago...

On 9/19/19 6:04 AM, Michael Kerrisk (man-pages) wrote:

> A further question... We now have three ways of getting a
> process file descriptor [*]:
> 
> open() of /proc/PID
> pidfd_open()
> clone()/clone3() with CLONE_PIDFD
> 
> I thought the FD was supposed to be equivalent in all three cases.
> However, if I try (on kernel 5.3) poll() an FD returned by opening
> /proc/PID, poll() tells me POLLNVAL for the FD. Is that difference
> intentional? (I am guessing it is not.)

Okay -- I made a misstep there, although my question remains.
I got the POLLNVAL return because I had opened /proc/PID with
the O_PATH flag. When I open /proc/PID with O_RDONLY, then poll()
on the FD always returns immediately (i.e., before the target
process has terminated), and the returned events are
POLLIN+POLLOUT.

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190511064908.21956-1-christian.brauner@ubuntu.com>
2019-09-11  8:58 ` Michael Kerrisk (man-pages)
2019-09-16  7:40   ` Christian Brauner
2019-09-18  6:49     ` Michael Kerrisk (man-pages)
2019-09-18  7:14       ` Christian Brauner
2019-09-19  4:04         ` Michael Kerrisk (man-pages)
2019-09-19  4:43           ` Michael Kerrisk (man-pages) [this message]
2019-09-19  6:47           ` Christian Brauner
2019-09-23  8:11             ` Michael Kerrisk (man-pages)
2019-09-23 14:13               ` Christian Brauner

Reply instructions:

You may reply publically 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=91e5e4fe-e09e-7f9b-1a53-0bc31c63ddce@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=jannh@google.com \
    --cc=linux-man@vger.kernel.org \
    --cc=oleg@redhat.com \
    /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

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git