On 01/26, Christian Brauner wrote:
quoted
--- a/include/uapi/linux/pidfd.h
+++ b/include/uapi/linux/pidfd.h
@@ -7,6 +7,7 @@
#include <linux/fcntl.h>
/* Flags for pidfd_open(). */
-#define PIDFD_NONBLOCK O_NONBLOCK
+#define PIDFD_NONBLOCK O_NONBLOCK
+#define PIDFD_THREAD O_EXCL // or anything else not used by anon_inode's
I like it!
The only request I would have is to not alias O_EXCL and PIDFD_THREAD.
Because it doesn't map as clearly as NONBLOCK did.
But it would be nice to have PIDFD_THREAD in file->f_flags. Where else
can we keep it?
I chose O_EXCL because it can only be used at open time, it can never
be used or changed after anon_inode_getfile(), so we can safely do
pidfd_file->f_flags |= PIDFD_THREAD;
in __pidfd_prepare() and then check in pidfd_poll/pidfd_send_signal.
What do you suggest instead?
Oleg.