sd_event_get_fd
systemd
sd_event_get_fd
3
sd_event_get_fd
Obtain a file descriptor to poll for event loop events
#include <systemd/sd-event.h>
int sd_event_get_fd
sd_event *event
Description
sd_event_get_fd() returns the file
descriptor that an event loop object returned by the
sd_event_new3
function uses to wait for events. This file descriptor may itself
be polled for
POLLIN/EPOLLIN
events. This makes it possible to embed an
sd-event3
event loop into another, possibly foreign, event loop.
The returned file descriptor refers to an epoll7
object. It is recommended not to alter it by invoking
epoll_ctl2
on it, in order to avoid interference with the event loop's inner
logic and assumptions.
Return Value
On success, sd_event_get_fd() returns a non-negative file descriptor. On
failure, it returns a negative errno-style error code.
Errors
Returned errors may indicate the following problems:
-EINVAL
event is not a valid pointer to an
sd_event structure.
-ECHILD
The event loop has been created in a different process, library or module instance.
Examples
Integration in the GLib event loop
See Also
sd-event3,
sd_event_new3,
sd_event_wait3,
epoll_ctl2,
epoll7