pipe: Add O_NOTIFICATION_PIPE
authorDavid Howells <dhowells@redhat.com>
Wed, 12 Feb 2020 13:58:35 +0000 (13:58 +0000)
committerDavid Howells <dhowells@redhat.com>
Tue, 19 May 2020 14:08:23 +0000 (15:08 +0100)
Add an O_NOTIFICATION_PIPE flag that can be passed to pipe2() to indicate
that the pipe being created is going to be used for notifications.  This
suppresses the use of splice(), vmsplice(), tee() and sendfile() on the
pipe as calling iov_iter_revert() on a pipe when a kernel notification
message has been inserted into the middle of a multi-buffer splice will be
messy.

The flag is given the same value as O_EXCL as it seems unlikely that
this flag will ever be applicable to pipes and I don't want to use up
another O_* bit unnecessarily.  An alternative could be to add a pipe3()
system call.

Signed-off-by: David Howells <dhowells@redhat.com>
include/uapi/linux/watch_queue.h

index 5f3d21e..9df7222 100644 (file)
@@ -3,6 +3,9 @@
 #define _UAPI_LINUX_WATCH_QUEUE_H
 
 #include <linux/types.h>
+#include <linux/fcntl.h>
+
+#define O_NOTIFICATION_PIPE    O_EXCL  /* Parameter to pipe2() selecting notification pipe */
 
 enum watch_notification_type {
        WATCH_TYPE_META         = 0,    /* Special record */