Skip to contentSkip to conversation

pipe.2: Add mention of O_NOTIFICATION_PIPE flag

PATCH Superseded [email protected] 2 participants 2 messages Jan 26, 2022 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pipe.2: Add mention of O_NOTIFICATION_PIPE flag

From: Cyril Hrubis <[email protected]>

This adds very basic information about the notification pipe that have been added into Linux 5.8.

There is some description about the interface at:

https://www.kernel.org/doc/html/latest/watch_queue.html

(I think that there is at least on bug in that page, since the notification pipe has to be opened with O_NOTIFICATION_PIPE which is defined to O_EXCL not O_TMPFILE)

The ENOPKG error should be clear from this header (see watch_queue_init() at the end):

https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/include/linux/watch_queue.h

TODO:

Where to place the info about the structures and ioctls()? Does that belong into pipe.2 as well?

---
 man2/pipe.2 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
man2/pipe.2 +17 -0
index 41a482f37..7d4db0323 100644
@@ -149,6 +149,14 @@ referred to by the new file descriptors.
 Using this flag saves extra calls to
 .BR fcntl (2)
 to achieve the same result.
+.TP
+.BR O_NOTIFICATION_PIPE
+Since Linux 5.8,
+.\" commit c73be61cede5882f9605a852414db559c0ebedfd
+general notification mechanims is build on the top of the pipe where kernel
+splices notification messages into pipes opened by userspace. The owner of the
+pipe has to tell the kernel which sources of events to watch and filters can also
+be applied to select which subevents should be placed into the pipe.
 .SH RETURN VALUE
 On success, zero is returned.
 On error, \-1 is returned,
@@ -191,6 +199,15 @@ The system-wide limit on the total number of open files has been reached.
 The user hard limit on memory that can be allocated for pipes
 has been reached and the caller is not privileged; see
 .BR pipe (7).
+.TP
+.B ENOPKG
+.RB ( pipe2 ())
+.B O_NOTIFICATION_PIPE
+was passed in
+.IR flags
+and support for notifications
+.RB ( CONFIG_WATCH_QUEUE )
+is not compiled into the kernel.
 .SH VERSIONS
 .BR pipe2 ()
 was added to Linux in version 2.6.27;
Signature · 1 line
2.34.1
#1 lore raw

Hello Cyril,

Quoted 16 lines · On 1/26/22 14:17, [email protected] wrote:

From: Cyril Hrubis <[email protected]>

This adds very basic information about the notification pipe that have been added into Linux 5.8.

There is some description about the interface at:

https://www.kernel.org/doc/html/latest/watch_queue.html

(I think that there is at least on bug in that page, since the notification pipe has to be opened with O_NOTIFICATION_PIPE which is defined to O_EXCL not O_TMPFILE)

The ENOPKG error should be clear from this header (see watch_queue_init() at the end):

Quoted 6 lines

https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/include/linux/watch_queue.h

TODO:

Where to place the info about the structures and ioctls()? Does that belong into pipe.2 as well?

We're documenting types in system_data_types(7). You could try there.

Regarding ioctls(), there are a few pages. Maybe you could start a new one; I don't know.

$ apropos ioctl
console_ioctl (4)    - ioctls for console terminal and virtual consoles
ioctl (2)            - control device
ioctl_console (2)    - ioctls for console terminal and virtual consoles
ioctl_fat (2)        - manipulating the FAT filesystem
ioctl_ficlone (2)    - share some the data of one file with another file
ioctl_ficlonerange (2) - share some the data of one file with another file
ioctl_fideduperange (2) - share some the data of one file with another file
ioctl_fslabel (2)    - get or set a filesystem label
ioctl_getfsmap (2)   - retrieve the physical layout of the filesystem
ioctl_iflags (2)     - ioctl() operations for inode flags
ioctl_ns (2)         - ioctl() operations for Linux namespaces
ioctl_tty (2)        - ioctls for terminals and serial lines
ioctl_userfaultfd (2) - create a file descriptor for handling page
faults in ...
tty_ioctl (4)        - ioctls for terminals and serial lines
blockdev (8)         - call block device ioctls from the command line
f2fs_io (8)          - f2fs ioctl utility
ioctl (3posix)       - control a STREAMS device (STREAMS)
ioctl_list (2)       - list of ioctl calls in Linux/i386 kernel
use_tioctl (3ncurses) - miscellaneous curses utility routines
use_tioctl_sp (3ncurses) - curses screen-pointer extension
Quoted 11 lines
---
 man2/pipe.2 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
man2/pipe.2 +0 -0
index 41a482f37..7d4db0323 100644

man2/pipe.2 referred to by the new file descriptors. · line 153

Quoted 5 lines
man2/pipe.2 +2 -0
@@ -149,6 +149,14 @@ referred to by the new file descriptors.
 Using this flag saves extra calls to
 .BR fcntl (2)
 to achieve the same result.
+.TP
+.BR O_NOTIFICATION_PIPE

Use .B
You don't need the 'R'.

groff_man(7):

       .B      Bold                         Font style macros
       .BI     Bold, italic alternating     Font style macros
       .BR     Bold, roman alternating      Font style macros

man2/pipe.2 referred to by the new file descriptors. · line 156

Quoted 3 lines
man2/pipe.2 +3 -0
+Since Linux 5.8,
+.\" commit c73be61cede5882f9605a852414db559c0ebedfd
+general notification mechanims is build on the top of the pipe where kernel

typo: mechanims
typo: build

man2/pipe.2 referred to by the new file descriptors. · line 157

Quoted 1 line
man2/pipe.2 +1 -0
+splices notification messages into pipes opened by userspace. The owner of the

Also:

Use semantic newlines
In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (commas, semicolons, colons, and so on), and long clauses should be split at phrase bound‐ aries. This convention, sometimes known as "semantic newlines", makes it easier to see the effect of patches, which often operate at the level of individual sentences, clauses, or phrases.

Also:

s/userspace/user space/

man-pages(7):
Preferred terms
The following table lists some preferred terms to use in man pages, mainly to ensure consistency across pages.

Term Avoid using Notes
───────────────────────────────────────────────────────────

[...]
user space userspace

Quoted 6 lines
man2/pipe.2 +2 -0
+pipe has to tell the kernel which sources of events to watch and filters can also
+be applied to select which subevents should be placed into the pipe.
 .SH RETURN VALUE
 On success, zero is returned.
 On error, \-1 is returned,

man2/pipe.2 The system-wide limit on the total number of open files has been reached. · line 207

Quoted 9 lines
man2/pipe.2 +6 -0
@@ -191,6 +199,15 @@ The system-wide limit on the total number of open files has been reached.
 The user hard limit on memory that can be allocated for pipes
 has been reached and the caller is not privileged; see
 .BR pipe (7).
+.TP
+.B ENOPKG
+.RB ( pipe2 ())
+.B O_NOTIFICATION_PIPE
+was passed in
+.IR flags

Use .I
You don't need the 'R'.

groff_man(7):

       .I      Italic                       Font style macros
       .IB     Italic, bold alternating     Font style macros
       .IP     Indented paragraph           Paragraph macros
       .IR     Italic, roman alternating    Font style macros

Thanks,

Alex

Quoted 6 lines
man2/pipe.2 +3 -0
+and support for notifications
+.RB ( CONFIG_WATCH_QUEUE )
+is not compiled into the kernel.
 .SH VERSIONS
 .BR pipe2 ()
 was added to Linux in version 2.6.27;
Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/