diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-04 17:38:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-04 17:38:08 +0200 |
commit | dace83cbd0c2212fc0e25d36d50711b19f14b1b6 (patch) | |
tree | c505fcc4425837fb098b1562753d469955a220be /src/login | |
parent | ee531d949c2f62374fc109252f8cbe61c2b8ee39 (diff) |
login: add new public API call sd_login_monitor_get_events() to get poll() flags to wait for
We should keep our options open, so that we can watch for POLLOUT later
on if we wish to. CUrrently this call will always return POLLIN however.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/libsystemd-login.sym | 5 | ||||
-rw-r--r-- | src/login/sd-login.c | 9 | ||||
-rw-r--r-- | src/login/test-login.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/login/libsystemd-login.sym b/src/login/libsystemd-login.sym index 272b0e2b52..55a828773b 100644 --- a/src/login/libsystemd-login.sym +++ b/src/login/libsystemd-login.sym @@ -58,3 +58,8 @@ LIBSYSTEMD_LOGIN_198 { global: sd_session_get_tty; } LIBSYSTEMD_LOGIN_186; + +LIBSYSTEMD_LOGIN_201 { +global: + sd_login_monitor_get_events; +} LIBSYSTEMD_LOGIN_198; diff --git a/src/login/sd-login.c b/src/login/sd-login.c index 8867e8c8eb..861a57166d 100644 --- a/src/login/sd-login.c +++ b/src/login/sd-login.c @@ -23,6 +23,7 @@ #include <string.h> #include <errno.h> #include <sys/inotify.h> +#include <sys/poll.h> #include "util.h" #include "cgroup-util.h" @@ -797,3 +798,11 @@ _public_ int sd_login_monitor_get_fd(sd_login_monitor *m) { return MONITOR_TO_FD(m); } + +_public_ int sd_login_monitor_get_events(sd_login_monitor *m) { + + if (!m) + return -EINVAL; + + return POLLIN; +} diff --git a/src/login/test-login.c b/src/login/test-login.c index 159ff3efc5..f639129636 100644 --- a/src/login/test-login.c +++ b/src/login/test-login.c @@ -185,7 +185,7 @@ int main(int argc, char* argv[]) { zero(pollfd); pollfd.fd = sd_login_monitor_get_fd(m); - pollfd.events = POLLIN; + pollfd.events = sd_login_monitor_get_events(m); for (n = 0; n < 5; n++) { r = poll(&pollfd, 1, -1); |