chiark / gitweb /
core: epoll and signalfd has been moved into sd event loop
[elogind.git] / src / libsystemd-bus / bus-kernel.c
index d0a9fbc3fb9af7476e65275ac910c17188900ed6..f66cf04e1640c759705fa942741ccdc0ff830b82 100644 (file)
@@ -418,8 +418,10 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m) {
 
                         if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
                                 sd_bus_error_setf(&error, SD_BUS_ERROR_SERVICE_UNKNOWN, "Destination %s not known", m->destination);
-                        else
+                        else {
+                                log_debug("Could not deliver message to %s as destination is not known. Ignoring.", m->destination);
                                 return 0;
+                        }
 
                 } else if (errno == EADDRNOTAVAIL) {
 
@@ -427,8 +429,10 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m) {
 
                         if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
                                 sd_bus_error_setf(&error, SD_BUS_ERROR_SERVICE_UNKNOWN, "Activation of %s not requested", m->destination);
-                        else
+                        else {
+                                log_debug("Could not deliver message to %s as destination is not activated. Ignoring.", m->destination);
                                 return 0;
+                        }
                 } else
                         return -errno;
 
@@ -897,7 +901,7 @@ int bus_kernel_read_message(sd_bus *bus) {
 
                 /* Anybody can send us invalid messages, let's just drop them. */
                 if (r == -EBADMSG || r == -EPROTOTYPE) {
-                        log_error("Ignoring invalid message: %s", strerror(-r));
+                        log_debug("Ignoring invalid message: %s", strerror(-r));
                         r = 0;
                 }
 
@@ -1211,3 +1215,19 @@ int bus_kernel_create_namespace(const char *name, char **s) {
 
         return fd;
 }
+
+int bus_kernel_monitor(sd_bus *bus) {
+        struct kdbus_cmd_monitor cmd_monitor;
+        int r;
+
+        assert(bus);
+
+        cmd_monitor.id = 0;
+        cmd_monitor.flags = KDBUS_MONITOR_ENABLE;
+
+        r = ioctl(bus->input_fd, KDBUS_CMD_MONITOR, &cmd_monitor);
+        if (r < 0)
+                return -errno;
+
+        return 1;
+}