diff options
author | Nathaniel McCallum <npmccallum@redhat.com> | 2018-01-24 09:45:48 -0500 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:50:15 +0200 |
commit | d776c8ca879216a12abaa39bc17721b071045cd6 (patch) | |
tree | 724d699521b59ab6fe7c917f6ca76d97b3e91e78 /src/systemd | |
parent | 8e735ec0a1f35b1a92576806404ed722403b7395 (diff) |
Add fd close support to sd_event_source
It is often the case that a file descriptor and its corresponding IO
sd_event_source share a life span. When this is the case, developers will
have to unref the event source and close the file descriptor. Instead, we
can just have the event source take ownership of the file descriptor and
close it when the event source is freed. This is especially useful when
combined with cleanup attributes and sd_event_source_unrefp().
This patch adds two new public functions:
sd_event_source_get_io_fd_own()
sd_event_source_set_io_fd_own()
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/sd-event.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h index 7b25d0c95..6b43315e9 100644 --- a/src/systemd/sd-event.h +++ b/src/systemd/sd-event.h @@ -127,6 +127,8 @@ int sd_event_source_get_enabled(sd_event_source *s, int *enabled); int sd_event_source_set_enabled(sd_event_source *s, int enabled); int sd_event_source_get_io_fd(sd_event_source *s); int sd_event_source_set_io_fd(sd_event_source *s, int fd); +int sd_event_source_get_io_fd_own(sd_event_source *s); +int sd_event_source_set_io_fd_own(sd_event_source *s, int own); int sd_event_source_get_io_events(sd_event_source *s, uint32_t* events); int sd_event_source_set_io_events(sd_event_source *s, uint32_t events); int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents); |