Re: [PATCH v2 0/5] pid: add pidfd_open()
From: Linus Torvalds
Date: Mon Apr 01 2019 - 12:08:19 EST
On Mon, Apr 1, 2019 at 8:55 AM Daniel Colascione <dancol@xxxxxxxxxx> wrote:
>
>
> > I wonder if we really want a fill procfs2, or maybe we could just make
> > the pidfd readable (yes, it's a directory file descriptor, but we
> > could allow reading).
>
> What would read(2) read?
We could make it read anything, but it would have to be something
people agree is sufficient (and not so expensive to create that rare
users of that data would find the overhead excessive).
Eg we could make it return the same thing that /proc/<pid>/status
reads right now.
But it sounds like you need pretty much all of /proc/<pid>/xyz:
> We do a lot of process state inspection and manipulation, including
> reading and writing the oom killer adjustment score, reading smaps,
> and the occasional cgroup manipulation. More generally, I'd also like
> to be able to write a race-free pkill(1)
I suspect most of what pkill wants is indeed in that 'status' file,
but other things aren't.
Linus