[systemd-devel] [PATCH] Break JobNew signal dbus signature by adding JobType.

Dimitri John Ledkov dimitri.j.ledkov at intel.com
Sun Jan 11 10:08:14 PST 2015

At the moment JobNew and JobRemoved signals are not useful for
tracking streams of events. JobType is missing from both of them, and
thus one can only track that "something" is happening and to which
units (And whether "something" is about to happen, finished, failed,
got aborted etc.). To get the JobType, one needs to query property
from the job, however this works only for "slow" jobs, typically the
job is gone on the systemd side already and thus subscriber has no
chance in quering the job type.

It looks like previously JobNew signal api was changed in 2012. Today
however there are slightly more clients of JobNew/JobRemoved
signals. Performing the codesearch.debian.net queries, JobRemoved has
a few users (e.g. go-systemd -> docker.io), but JobNew only has
systemd-ui as it's consumer. I am proposing to break JobNew signature,
patch systemd-ui to handle both cases. And then users of JobRemoved
signal would be able to get job_type, by subscribing to JobNew signal
and caching/storing the job_type.
 src/core/dbus-job.c     | 2 +-
 src/core/dbus-manager.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 8b5ea25..6d6a73b 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -121,7 +121,7 @@ static int send_new_signal(sd_bus *bus, void *userdata) {
         if (r < 0)
                 return r;
-        r = sd_bus_message_append(m, "uos", j->id, p, j->unit->id);
+        r = sd_bus_message_append(m, "uoss", j->id, p, j->unit->id, j->type);
         if (r < 0)
                 return r;
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 6181ba8..2ef301f 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -2020,7 +2020,7 @@ const sd_bus_vtable bus_manager_vtable[] = {
         SD_BUS_SIGNAL("UnitNew", "so", 0),
         SD_BUS_SIGNAL("UnitRemoved", "so", 0),
-        SD_BUS_SIGNAL("JobNew", "uos", 0),
+        SD_BUS_SIGNAL("JobNew", "uoss", 0),
         SD_BUS_SIGNAL("JobRemoved", "uoss", 0),
         SD_BUS_SIGNAL("StartupFinished", "tttttt", 0),
         SD_BUS_SIGNAL("UnitFilesChanged", NULL, 0),

More information about the systemd-devel mailing list