[systemd-commits] 4 commits - .gitignore src/ac-power src/analyze src/ask-password src/cgls src/cgroups-agent src/cgtop src/core src/detect-virt src/fsck src/getty-generator src/gudev src/initctl src/libsystemd-daemon src/libsystemd-id128 src/libudev src/modules-load src/notify src/nspawn src/quotacheck src/random-seed src/rc-local-generator src/remount-api-vfs src/reply-password src/shared src/shutdownd src/stdio-bridge src/sysctl src/systemctl src/timestamp src/tmpfiles src/tty-ask-password-agent src/udev src/update-utmp

Lennart Poettering lennart at kemper.freedesktop.org
Fri Apr 13 12:39:19 PDT 2012


 .gitignore                          |  138 +++++++++++++++++-------------------
 src/ac-power/Makefile               |    1 
 src/analyze/Makefile                |    1 
 src/ask-password/Makefile           |    1 
 src/cgls/Makefile                   |    1 
 src/cgroups-agent/Makefile          |    1 
 src/cgtop/Makefile                  |    1 
 src/core/dbus-manager.c             |   24 ++++--
 src/core/manager.c                  |   19 ++--
 src/detect-virt/Makefile            |    1 
 src/fsck/Makefile                   |    1 
 src/getty-generator/Makefile        |    1 
 src/gudev/Makefile                  |    1 
 src/initctl/Makefile                |    1 
 src/libsystemd-daemon/Makefile      |    1 
 src/libsystemd-id128/Makefile       |    1 
 src/libudev/Makefile                |    1 
 src/modules-load/Makefile           |    1 
 src/notify/Makefile                 |    1 
 src/nspawn/Makefile                 |    1 
 src/nspawn/nspawn.c                 |    2 
 src/quotacheck/Makefile             |    1 
 src/random-seed/Makefile            |    1 
 src/rc-local-generator/Makefile     |    1 
 src/remount-api-vfs/Makefile        |    1 
 src/reply-password/Makefile         |    1 
 src/shared/dbus-common.c            |   75 +++++++++++++++++--
 src/shared/dbus-common.h            |    4 +
 src/shutdownd/Makefile              |    1 
 src/stdio-bridge/Makefile           |    1 
 src/sysctl/Makefile                 |    1 
 src/systemctl/Makefile              |    1 
 src/timestamp/Makefile              |    1 
 src/tmpfiles/Makefile               |    1 
 src/tty-ask-password-agent/Makefile |    1 
 src/udev/Makefile                   |    1 
 src/update-utmp/Makefile            |    1 
 37 files changed, 201 insertions(+), 92 deletions(-)

New commits:
commit b562f5a57d11d356aab26b08481f3befffff0822
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Apr 13 21:36:37 2012 +0200

    build-sys: add stub makefiles to all subdirs to ease development with emacs

diff --git a/.gitignore b/.gitignore
index ba34a3a..2bfc77c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,73 +6,71 @@
 /systemd-cat
 /systemd-rc-local-generator
 /libsystemd-id128.pc
-journalctl
-systemd-journald
-test-id128
-test-journal
-test-install
-org.freedesktop.hostname1.xml
-org.freedesktop.locale1.xml
-libsystemd-daemon.pc
-libsystemd-login.pc
-test-login
-loginctl
-systemd-localed
-systemd-timedated
-org.freedesktop.timedate1.xml
-systemd-logind
-systemd-uaccess
-systemd-hostnamed
-systemd-binfmt
-systemd-getty-generator
-systemd-nspawn
-systemd-stdio-bridge
-systemd-machine-id-setup
-systemd-detect-virt
-systemd-sysctl
-test-strv
-systemd-ac-power
-systemd-timestamp
-systemd-cryptsetup
-systemd-cryptsetup-generator
-systemd-tty-ask-password-agent
-systemd-fsck
-systemd-quotacheck
-systemd-user-sessions
-systemd-shutdown
-systemd-tmpfiles
-systemd-readahead-collect
-systemd-readahead-replay
-systemd-reply-password
-systemd-gnome-ask-password-agent
-systemd-ask-password
-systemd-kmsg-syslogd
-systemd-remount-api-vfs
-test-hostname
-systemd-modules-load
-systemd-vconsole-setup
-systemd-shutdownd
-systemd-random-seed
-systemd-update-utmp
-test-env-replace
-systemd-cgls
-systemd.pc
-test-cgroup
+/journalctl
+/systemd-journald
+/test-id128
+/test-journal
+/test-install
+/org.freedesktop.hostname1.xml
+/org.freedesktop.locale1.xml
+/libsystemd-daemon.pc
+/libsystemd-login.pc
+/test-login
+/loginctl
+/systemd-localed
+/systemd-timedated
+/org.freedesktop.timedate1.xml
+/systemd-logind
+/systemd-uaccess
+/systemd-hostnamed
+/systemd-binfmt
+/systemd-getty-generator
+/systemd-nspawn
+/systemd-stdio-bridge
+/systemd-machine-id-setup
+/systemd-detect-virt
+/systemd-sysctl
+/test-strv
+/systemd-ac-power
+/systemd-timestamp
+/systemd-cryptsetup
+/systemd-cryptsetup-generator
+/systemd-tty-ask-password-agent
+/systemd-fsck
+/systemd-quotacheck
+/systemd-user-sessions
+/systemd-shutdown
+/systemd-tmpfiles
+/systemd-readahead-collect
+/systemd-readahead-replay
+/systemd-reply-password
+/systemd-gnome-ask-password-agent
+/systemd-ask-password
+/systemd-kmsg-syslogd
+/systemd-remount-api-vfs
+/test-hostname
+/systemd-modules-load
+/systemd-vconsole-setup
+/systemd-shutdownd
+/systemd-random-seed
+/systemd-update-utmp
+/test-env-replace
+/systemd-cgls
+/systemd.pc
+/test-cgroup
 .libs/
-systemd-notify
-test-daemon
-systemd-install
-org.freedesktop.systemd1.*.xml
-test-ns
-test-loopback
-systemd-cgroups-agent
-systemd-initctl
+/systemd-notify
+/test-daemon
+/org.freedesktop.systemd1.*.xml
+/test-ns
+/test-loopback
+/systemd-cgroups-agent
+/systemd-initctl
 /systemd
-test-engine
-test-job-type
-systemd-stdout-syslog-bridge
-systemctl
-systemadm
+/test-engine
+/test-job-type
+/systemctl
+/systemadm
 .dirstamp
 *.1
 *.3
@@ -103,11 +101,11 @@ missing
 stamp-*
 *.stamp
 /Makefile
-ltmain.sh
-*.tar.xz
-*.tar.gz
-*.tar.bz2
-libtool
+/ltmain.sh
+/*.tar.xz
+/*.tar.gz
+/*.tar.bz2
+/libtool
 /accelerometer
 /ata_id
 /cdrom_id
diff --git a/src/ac-power/Makefile b/src/ac-power/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/ac-power/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/analyze/Makefile b/src/analyze/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/analyze/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/ask-password/Makefile b/src/ask-password/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/ask-password/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/cgls/Makefile b/src/cgls/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/cgls/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/cgroups-agent/Makefile b/src/cgroups-agent/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/cgroups-agent/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/cgtop/Makefile b/src/cgtop/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/cgtop/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/detect-virt/Makefile b/src/detect-virt/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/detect-virt/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/fsck/Makefile b/src/fsck/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/fsck/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/getty-generator/Makefile b/src/getty-generator/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/getty-generator/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/gudev/Makefile b/src/gudev/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/gudev/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/initctl/Makefile b/src/initctl/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/initctl/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/libsystemd-daemon/Makefile b/src/libsystemd-daemon/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/libsystemd-daemon/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/libsystemd-id128/Makefile b/src/libsystemd-id128/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/libsystemd-id128/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/libudev/Makefile b/src/libudev/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/libudev/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/modules-load/Makefile b/src/modules-load/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/modules-load/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/notify/Makefile b/src/notify/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/notify/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/nspawn/Makefile b/src/nspawn/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/nspawn/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/quotacheck/Makefile b/src/quotacheck/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/quotacheck/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/random-seed/Makefile b/src/random-seed/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/random-seed/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/rc-local-generator/Makefile b/src/rc-local-generator/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/rc-local-generator/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/remount-api-vfs/Makefile b/src/remount-api-vfs/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/remount-api-vfs/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/reply-password/Makefile b/src/reply-password/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/reply-password/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/shutdownd/Makefile b/src/shutdownd/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/shutdownd/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/stdio-bridge/Makefile b/src/stdio-bridge/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/stdio-bridge/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/sysctl/Makefile b/src/sysctl/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/sysctl/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/systemctl/Makefile b/src/systemctl/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/systemctl/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/timestamp/Makefile b/src/timestamp/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/timestamp/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/tmpfiles/Makefile b/src/tmpfiles/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/tmpfiles/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/tty-ask-password-agent/Makefile b/src/tty-ask-password-agent/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/tty-ask-password-agent/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/udev/Makefile b/src/udev/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/udev/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file
diff --git a/src/update-utmp/Makefile b/src/update-utmp/Makefile
new file mode 120000
index 0000000..d0b0e8e
--- /dev/null
+++ b/src/update-utmp/Makefile
@@ -0,0 +1 @@
+../Makefile
\ No newline at end of file

commit 9537eab07053d1fc26ce627117ce4da076bdbf86
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Apr 13 21:33:45 2012 +0200

    nspawn: add missing include lines

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 9fc256e..ce727b6 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -38,6 +38,8 @@
 #include <sys/signalfd.h>
 #include <grp.h>
 #include <linux/fs.h>
+#include <sys/un.h>
+#include <sys/socket.h>
 
 #include <systemd/sd-daemon.h>
 

commit c757a65b6afb462bde082b5362bbb5a074b5bb7b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Apr 13 21:33:28 2012 +0200

    watchdog: make watchdog dbus properties writable

diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 88945b5..e81e6af 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -30,6 +30,7 @@
 #include "build.h"
 #include "dbus-common.h"
 #include "install.h"
+#include "watchdog.h"
 
 #define BUS_MANAGER_INTERFACE_BEGIN                                     \
         " <interface name=\"org.freedesktop.systemd1.Manager\">\n"
@@ -241,8 +242,8 @@
         "  <property name=\"DefaultControllers\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"DefaultStandardOutput\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"DefaultStandardError\" type=\"s\" access=\"read\"/>\n" \
-        "  <property name=\"RuntimeWatchdogUSec\" type=\"s\" access=\"read\"/>\n" \
-        "  <property name=\"ShutdownWatchdogUSec\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"RuntimeWatchdogUSec\" type=\"s\" access=\"readwrite\"/>\n" \
+        "  <property name=\"ShutdownWatchdogUSec\" type=\"s\" access=\"readwrite\"/>\n" \
         "  <property name=\"HaveWatchdog\" type=\"b\" access=\"read\"/>\n"
 
 #ifdef HAVE_SYSV_COMPAT
@@ -508,6 +509,17 @@ static int bus_manager_append_have_watchdog(DBusMessageIter *i, const char *prop
         return 0;
 }
 
+static int bus_manager_set_runtime_watchdog_usec(DBusMessageIter *i, const char *property, void *data) {
+        uint64_t *t = data;
+
+        assert(i);
+        assert(property);
+
+        dbus_message_iter_get_basic(i, t);
+
+        return watchdog_set_timeout(t);
+}
+
 static const char systemd_property_string[] =
         PACKAGE_STRING "\0"
         DISTRIBUTION "\0"
@@ -529,8 +541,8 @@ static const BusProperty bus_manager_properties[] = {
         { "StartupTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, startup_timestamp.monotonic) },
         { "FinishTimestamp", bus_property_append_uint64,           "t", offsetof(Manager, finish_timestamp.realtime)   },
         { "FinishTimestampMonotonic", bus_property_append_uint64,  "t", offsetof(Manager, finish_timestamp.monotonic)  },
-        { "LogLevel",      bus_manager_append_log_level,           "s", 0,                                             0, bus_manager_set_log_level },
-        { "LogTarget",     bus_manager_append_log_target,          "s", 0,                                             0, bus_manager_set_log_target },
+        { "LogLevel",      bus_manager_append_log_level,           "s", 0,                                             false, bus_manager_set_log_level },
+        { "LogTarget",     bus_manager_append_log_target,          "s", 0,                                             false, bus_manager_set_log_target },
         { "NNames",        bus_manager_append_n_names,             "u", 0                                              },
         { "NJobs",         bus_manager_append_n_jobs,              "u", 0                                              },
         { "NInstalledJobs",bus_property_append_uint32,             "u", offsetof(Manager, n_installed_jobs)            },
@@ -547,8 +559,8 @@ static const BusProperty bus_manager_properties[] = {
         { "DefaultControllers", bus_property_append_strv,         "as", offsetof(Manager, default_controllers),        true },
         { "DefaultStandardOutput", bus_manager_append_exec_output, "s", offsetof(Manager, default_std_output)          },
         { "DefaultStandardError",  bus_manager_append_exec_output, "s", offsetof(Manager, default_std_error)           },
-        { "RuntimeWatchdogUSec", bus_property_append_usec,         "t", offsetof(Manager, runtime_watchdog),           },
-        { "ShutdownWatchdogUSec", bus_property_append_usec,        "t", offsetof(Manager, shutdown_watchdog),          },
+        { "RuntimeWatchdogUSec", bus_property_append_usec,         "t", offsetof(Manager, runtime_watchdog),           false, bus_manager_set_runtime_watchdog_usec },
+        { "ShutdownWatchdogUSec", bus_property_append_usec,        "t", offsetof(Manager, shutdown_watchdog),          false, bus_property_set_usec },
         { "HaveWatchdog",  bus_manager_append_have_watchdog,       "b", 0                                              },
 #ifdef HAVE_SYSV_COMPAT
         { "SysVConsole",   bus_property_append_bool,               "b", offsetof(Manager, sysv_console)                },
diff --git a/src/core/manager.c b/src/core/manager.c
index 1d32adf..c8ac29b 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2457,7 +2457,6 @@ static int process_event(Manager *m, struct epoll_event *ev) {
 
 int manager_loop(Manager *m) {
         int r;
-        int wait_msec = -1;
 
         RATELIMIT_DEFINE(rl, 1*USEC_PER_SEC, 50000);
 
@@ -2476,18 +2475,12 @@ int manager_loop(Manager *m) {
         if (r < 0)
                 return r;
 
-        /* Sleep for half the watchdog time */
-        if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM)  {
-                wait_msec = (int) (m->runtime_watchdog / 2 / USEC_PER_MSEC);
-                if (wait_msec <= 0)
-                        wait_msec = 1;
-        }
-
         while (m->exit_code == MANAGER_RUNNING) {
                 struct epoll_event event;
                 int n;
+                int wait_msec = -1;
 
-                if (wait_msec >= 0)
+                if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM)
                         watchdog_ping();
 
                 if (!ratelimit_test(&rl)) {
@@ -2518,6 +2511,14 @@ int manager_loop(Manager *m) {
                 if (swap_dispatch_reload(m) > 0)
                         continue;
 
+                /* Sleep for half the watchdog time */
+                if (m->runtime_watchdog > 0 && m->running_as == MANAGER_SYSTEM) {
+                        wait_msec = (int) (m->runtime_watchdog / 2 / USEC_PER_MSEC);
+                        if (wait_msec <= 0)
+                                wait_msec = 1;
+                } else
+                        wait_msec = -1;
+
                 n = epoll_wait(m->epoll_fd, &event, 1, wait_msec);
                 if (n < 0) {
 
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index badd037..6d000e1 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -660,6 +660,16 @@ int bus_property_append_long(DBusMessageIter *i, const char *property, void *dat
         return 0;
 }
 
+int bus_property_set_uint64(DBusMessageIter *i, const char *property, void *data) {
+        uint64_t *t = data;
+
+        assert(i);
+        assert(property);
+
+        dbus_message_iter_get_basic(i, t);
+        return 0;
+}
+
 const char *bus_errno_to_dbus(int error) {
 
         switch(error) {
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index ca398fc..2bfcdfa 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -144,6 +144,9 @@ int bus_property_append_long(DBusMessageIter *i, const char *property, void *dat
 #define bus_property_append_unsigned bus_property_append_uint32
 #define bus_property_append_usec bus_property_append_uint64
 
+int bus_property_set_uint64(DBusMessageIter *i, const char *property, void *data);
+#define bus_property_set_usec bus_property_set_uint64
+
 #define DEFINE_BUS_PROPERTY_APPEND_ENUM(function,name,type)             \
         int function(DBusMessageIter *i, const char *property, void *data) { \
                 const char *value;                                      \

commit d4e7373bbbc878b0d8ed1c28e21262a6d908d616
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Apr 13 21:32:17 2012 +0200

    dbus: automatically send out changed events for properties written to

diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index 038fdd4..badd037 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -403,6 +403,7 @@ get_prop:
                 DBusMessageIter sub;
                 char *sig;
                 void *data;
+                DBusMessage *changed;
 
                 if (!dbus_message_iter_init(message, &iter) ||
                     dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
@@ -454,22 +455,34 @@ set_prop:
                         dbus_free(sig);
                         return bus_send_error_reply(c, message, NULL, -EINVAL);
                 }
-
                 dbus_free(sig);
 
-                data = (char*)bp->base + p->offset;
+                data = (uint8_t*) bp->base + p->offset;
                 if (p->indirect)
                         data = *(void**)data;
+
                 r = p->set(&sub, property, data);
-                if (r < 0) {
-                        if (r == -ENOMEM)
-                                goto oom;
+                if (r == -ENOMEM)
+                        goto oom;
+                else if (r < 0)
                         return bus_send_error_reply(c, message, NULL, r);
-                }
 
                 reply = dbus_message_new_method_return(message);
                 if (!reply)
                         goto oom;
+
+                /* Send out a signal about this, but it doesn't really
+                 * matter if this fails, so eat all errors */
+                changed = bus_properties_changed_one_new(
+                                dbus_message_get_path(message),
+                                interface,
+                                property);
+                if (changed) {
+                        dbus_connection_send(c, changed, NULL);
+                        dbus_message_unref(changed);
+                }
+
+
         } else {
                 const char *interface = dbus_message_get_interface(message);
 
@@ -729,7 +742,8 @@ DBusMessage* bus_properties_changed_new(const char *path, const char *interface,
         assert(interface);
         assert(properties);
 
-        if (!(m = dbus_message_new_signal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged")))
+        m = dbus_message_new_signal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged");
+        if (!m)
                 goto oom;
 
         dbus_message_iter_init_append(m, &iter);
@@ -759,6 +773,43 @@ oom:
         return NULL;
 }
 
+DBusMessage* bus_properties_changed_one_new(const char *path, const char *interface, const char *property) {
+        DBusMessage *m;
+        DBusMessageIter iter, sub;
+
+        assert(interface);
+        assert(property);
+
+        m = dbus_message_new_signal(path, "org.freedesktop.DBus.Properties", "PropertiesChanged");
+        if (!m)
+                goto oom;
+
+        dbus_message_iter_init_append(m, &iter);
+
+        /* We won't send any property values, since they might be
+         * large and sometimes not cheap to generated */
+
+        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &interface) ||
+            !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &sub) ||
+            !dbus_message_iter_close_container(&iter, &sub) ||
+            !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &sub))
+                goto oom;
+
+        if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &property))
+                goto oom;
+
+        if (!dbus_message_iter_close_container(&iter, &sub))
+                goto oom;
+
+        return m;
+
+oom:
+        if (m)
+                dbus_message_unref(m);
+
+        return NULL;
+}
+
 uint32_t bus_flags_to_events(DBusWatch *bus_watch) {
         unsigned flags;
         uint32_t events = 0;
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index 38d8e65..ca398fc 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -178,6 +178,7 @@ int bus_property_append_long(DBusMessageIter *i, const char *property, void *dat
 const char *bus_errno_to_dbus(int error);
 
 DBusMessage* bus_properties_changed_new(const char *path, const char *interface, const char *properties);
+DBusMessage* bus_properties_changed_one_new(const char *path, const char *interface, const char *property);
 
 uint32_t bus_flags_to_events(DBusWatch *bus_watch);
 unsigned bus_events_to_flags(uint32_t events);



More information about the systemd-commits mailing list