Messages in this thread | ![/](/images/icornerl.gif) | | Date | Wed, 31 Jan 2024 15:39:00 +0100 | From | Christian Brauner <> | Subject | Re: [PATCH v3 0/1] pidfd: implement PIDFD_THREAD flag for pidfd_open() |
| |
On Wed, Jan 31, 2024 at 03:12:04PM +0100, Oleg Nesterov wrote: > Before I forget this... > > After this patch we can easily add another feature, pidfd_poll() > can add, say, POLLHUP to poll_flags if the pid is "dead". > > So the user can do > > poll(pidfd, { .revents = POLLHUP }); > > and it will block until release_task() is called and this pid is > no longer in use (pid_task() == NULL). > > Do you think this can be useful?
Yeah, I think this is something that people would find useful. IIUC, it would essentially allow them to do things like wait until a task has been waited upon which for service managers is very useful information.
---
Btw, bigger picture for a second. You probably haven't kept track of this but the fact that we got pidfds - thanks a lot to your review and help - has made quite a huge difference in userspace. Since we last did any meaningful work we got:
* systemd completely relying on pidfds to manage services to guard against any pid races. * Extended dbus to allow authentication via pidfds. * Extended policy kit to enable secure authentication of processes via pidfds. * Language support for pidfds: Go, Rust etc. * An endless number of tools that added support for them. * glibc support for pidfd apis.
There's a bunch more. That literally obliterated whole bug classes.
I think with PIDFD_THREAD support it might make it interesting to use it for some pthread management as well.
| ![\](/images/icornerr.gif) |