chiark / gitweb /
monitor udev for device changes
[elogind.git] / manager.c
index ac1c79c5f6f634a2c6e98235801a3e194c39ecdf..e0ffe93270a4e10479dc54fb0be3851ac5a12df0 100644 (file)
--- a/manager.c
+++ b/manager.c
@@ -56,7 +56,7 @@ Manager* manager_new(void) {
         if (!(m = new0(Manager, 1)))
                 return NULL;
 
-        m->signal_watch.fd = m->mount_watch.fd = m->epoll_fd = -1;
+        m->signal_watch.fd = m->mount_watch.fd = m->udev_watch.fd = m->epoll_fd = -1;
 
         if (!(m->units = hashmap_new(string_hash_func, string_compare_func)))
                 goto fail;
@@ -1126,7 +1126,7 @@ static int process_event(Manager *m, struct epoll_event *ev, bool *quit) {
         case WATCH_SIGNAL:
 
                 /* An incoming signal? */
-                if (ev->events != POLLIN)
+                if (ev->events != EPOLLIN)
                         return -EINVAL;
 
                 if ((r = manager_process_signal_fd(m, quit)) < 0)
@@ -1162,6 +1162,11 @@ static int process_event(Manager *m, struct epoll_event *ev, bool *quit) {
                 mount_fd_event(m, ev->events);
                 break;
 
+        case WATCH_UDEV:
+                /* Some notification from udev, intended for the device subsystem */
+                device_fd_event(m, ev->events);
+                break;
+
         default:
                 assert_not_reached("Unknown epoll event type.");
         }