chiark / gitweb /
implement recursive_stop/stop_when_unneeded unit flags
[elogind.git] / socket.c
index 7bcd112739c36f5261bb77e961beb960f63998b4..3bfdf4148ddf2e3006bfccd53539d2a02f5b47cd 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -5,7 +5,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <sys/poll.h>
+#include <sys/epoll.h>
 #include <signal.h>
 
 #include "unit.h"
@@ -88,8 +88,11 @@ static int socket_init(Unit *u) {
         s->timeout_usec = DEFAULT_TIMEOUT_USEC;
         exec_context_init(&s->exec_context);
 
-        if ((r = unit_load_fragment_and_dropin(u)) < 0)
+        if ((r = unit_load_fragment_and_dropin(u)) <= 0) {
+                if (r == 0)
+                        r = -ENOENT;
                 goto fail;
+        }
 
         if (!(t = unit_name_change_suffix(unit_id(u), ".service"))) {
                 r = -ENOMEM;
@@ -282,7 +285,7 @@ static int socket_watch_fds(Socket *s) {
                 if (p->fd < 0)
                         continue;
 
-                if ((r = unit_watch_fd(UNIT(s), p->fd, POLLIN, &p->fd_watch)) < 0)
+                if ((r = unit_watch_fd(UNIT(s), p->fd, EPOLLIN, &p->fd_watch)) < 0)
                         goto fail;
         }
 
@@ -631,7 +634,7 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
 
         log_debug("Incoming traffic on %s", unit_id(u));
 
-        if (events != POLLIN)
+        if (events != EPOLLIN)
                 socket_enter_stop_pre(s, false);
 
         socket_enter_running(s);