RE: [RFC PATCH] Minimal non-child process exit notification support

From: David Laight
Date: Wed Oct 31 2018 - 08:27:14 EST


From: Daniel Colascione
> Sent: 29 October 2018 17:53
>
> This patch adds a new file under /proc/pid, /proc/pid/exithand.
> Attempting to read from an exithand file will block until the
> corresponding process exits, at which point the read will successfully
> complete with EOF. The file descriptor supports both blocking
> operations and poll(2). It's intended to be a minimal interface for
> allowing a program to wait for the exit of a process that is not one
> of its children.

Why do you need an extra file?
It ought to be possible to use poll() to wait for POLLERR having set
'events' to zero on any of the nodes in /proc/pid - or even on
the directory itself.

Indeed, to avoid killing the wrong process you need to have opened
some node of /proc/pid/* (maybe cmdline) before sending the kill
signal.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)