Re: [PATCH] clone.2: add CLONE_PIDFD entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux