pipe: Add general notification queue support
Make it possible to have a general notification queue built on top of a standard pipe. Notifications are 'spliced' into the pipe and then read out. splice(), vmsplice() and sendfile() are forbidden on pipes used for notifications as post_one_notification() cannot take pipe->mutex. This means that notifications could be posted in between individual pipe buffers, making iov_iter_revert() difficult to effect. The way the notification queue is used is: (1) An application opens a pipe with a special flag and indicates the number of messages it wishes to be able to queue at once (this can only be set once): pipe2(fds, O_NOTIFICATION_PIPE); ioctl(fds[0], IOC_WATCH_QUEUE_SET_SIZE, queue_depth); (2) The application then uses poll() and read() as normal to extract data from the pipe. read() will return multiple notifications if the buffer is big enough, but it will not split a notification across buffers - rather it will return a shor...
Showing
- Documentation/userspace-api/ioctl/ioctl-number.rst 1 addition, 0 deletionsDocumentation/userspace-api/ioctl/ioctl-number.rst
- Documentation/watch_queue.rst 339 additions, 0 deletionsDocumentation/watch_queue.rst
- fs/pipe.c 137 additions, 69 deletionsfs/pipe.c
- fs/splice.c 6 additions, 6 deletionsfs/splice.c
- include/linux/pipe_fs_i.h 18 additions, 1 deletioninclude/linux/pipe_fs_i.h
- include/linux/watch_queue.h 127 additions, 0 deletionsinclude/linux/watch_queue.h
- include/uapi/linux/watch_queue.h 20 additions, 0 deletionsinclude/uapi/linux/watch_queue.h
- init/Kconfig 12 additions, 0 deletionsinit/Kconfig
- kernel/Makefile 1 addition, 0 deletionskernel/Makefile
- kernel/watch_queue.c 657 additions, 0 deletionskernel/watch_queue.c
Please register or sign in to comment