From a06c92eb484d6193d5f45e3002acfe4d6518151a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 10 Aug 2023 15:01:16 +0200 Subject: [PATCH] sd-event: explicit document what to do with epoll-incompatible fds --- man/sd_event_add_io.xml | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/man/sd_event_add_io.xml b/man/sd_event_add_io.xml index 4201c68f0d0..d5495732a79 100644 --- a/man/sd_event_add_io.xml +++ b/man/sd_event_add_io.xml @@ -100,22 +100,21 @@ Description - sd_event_add_io() adds a new I/O event - source to an event loop. The event loop object is specified in the - event parameter, the event source object is - returned in the source parameter. The - fd parameter takes the UNIX file descriptor - to watch, which may refer to a socket, a FIFO, a message queue, a - serial connection, a character device, or any other file descriptor - compatible with Linux - epoll7. The - events parameter takes a bit mask of events - to watch for, a combination of the following event flags: - EPOLLIN, EPOLLOUT, - EPOLLRDHUP, EPOLLPRI, - and EPOLLET, see - epoll_ctl2 - for details. + sd_event_add_io() adds a new I/O event source to an event loop. The event loop + object is specified in the event parameter, the event source object is returned in + the source parameter. The fd parameter takes the UNIX file + descriptor to watch, which may refer to a socket, a FIFO, a message queue, a serial connection, a + character device, or any other file descriptor compatible with Linux epoll7. The + events parameter takes a bit mask of events to watch for, a combination of the + following event flags: EPOLLIN, EPOLLOUT, + EPOLLRDHUP, EPOLLPRI, and EPOLLET, see + epoll_ctl2 for + details. Note that not all file descriptors are compatible with epoll, for example regular file or + directories are not. If this function is called with a file descriptor that does not support epoll, + -EPERM is returned (also see below). In most cases such file descriptors may be + treated as always-readable or always-writable, so that IO event watching is unnecessary. The handler is a function to call when the event source is triggered or NULL. The userdata pointer will be passed to the handler @@ -278,6 +277,16 @@ The passed event source is not an I/O event source. + + + -EPERM + + The passed file descriptor does not support the epoll7 + API, for example because it is a regular file or directory. See epoll_ctl2 + for details. + -- 2.47.3