[systemd-commits] 2 commits - src/core src/libsystemd-bus
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Nov 22 11:20:04 PST 2013
src/core/dbus-job.c | 20 ++++++++++++--------
src/core/dbus-manager.c | 34 ++++++++++++++++++++++++----------
src/core/dbus-manager.h | 4 ++--
src/core/dbus-unit.c | 6 ++----
src/libsystemd-bus/bus-util.h | 4 ++--
5 files changed, 42 insertions(+), 26 deletions(-)
New commits:
commit edb5dd18752033d58fea7386773952cf1a4f9273
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Nov 22 20:19:54 2013 +0100
bus: protected dual timestamp property macro for misusage
diff --git a/src/libsystemd-bus/bus-util.h b/src/libsystemd-bus/bus-util.h
index 38533be..20739a9 100644
--- a/src/libsystemd-bus/bus-util.h
+++ b/src/libsystemd-bus/bus-util.h
@@ -168,7 +168,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref);
struct __useless_struct_to_allow_trailing_semicolon__
#define BUS_PROPERTY_DUAL_TIMESTAMP(name, offset, flags) \
- SD_BUS_PROPERTY(name, "t", bus_property_get_usec, offset + offsetof(struct dual_timestamp, realtime), flags), \
- SD_BUS_PROPERTY(name "Monotonic", "t", bus_property_get_usec, offset + offsetof(struct dual_timestamp, monotonic), flags)
+ SD_BUS_PROPERTY(name, "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, realtime), (flags)), \
+ SD_BUS_PROPERTY(name "Monotonic", "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, monotonic), (flags))
int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
commit 39abcaee3e905f41efcb8b11ff4ff013f552620c
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Nov 22 20:19:27 2013 +0100
core: don't warn loudly if we cannot send a bus signal to a disconnected client
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 923d545..8c12b52 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -84,7 +84,7 @@ static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
Iterator i;
sd_bus *b;
unsigned n, m;
- int r;
+ int r, ret;
assert(j);
assert(send_message);
@@ -105,17 +105,22 @@ static int foreach_client(Job *j, int (*send_message)(sd_bus *bus, const char *n
if (one_destination)
return send_message(one_destination->bus, isempty(one_destination->name) ? NULL : one_destination->name, j);
+ ret = 0;
+
/* Send to everybody */
SET_FOREACH(b, j->manager->private_buses, i) {
r = send_message(b, NULL, j);
if (r < 0)
- return r;
+ ret = r;
}
- if (j->manager->api_bus)
- return send_message(j->manager->api_bus, NULL, j);
+ if (j->manager->api_bus) {
+ r = send_message(j->manager->api_bus, NULL, j);
+ if (r < 0)
+ ret = r;
+ }
- return 0;
+ return ret;
}
static int send_new_signal(sd_bus *bus, const char *destination, Job *j) {
@@ -171,7 +176,7 @@ void bus_job_send_change_signal(Job *j) {
r = foreach_client(j, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal);
if (r < 0)
- log_warning("Failed to send job change signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
+ log_debug("Failed to send job change signal for %u: %s", j->id, strerror(-r));
j->sent_dbus_new_signal = true;
}
@@ -215,6 +220,5 @@ void bus_job_send_removed_signal(Job *j) {
r = foreach_client(j, send_removed_signal);
if (r < 0)
- log_warning("Failed to send job removal signal for %u/%s: %s", j->id, j->unit->id, strerror(-r));
- return;
+ log_debug("Failed to send job remove signal for %u: %s", j->id, strerror(-r));
}
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 9ecf14c..b934624 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1624,7 +1624,7 @@ int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, cons
Iterator i;
sd_bus *b;
unsigned n;
- int r;
+ int r, ret;
n = set_size(m->subscribed);
if (n <= 0)
@@ -1636,17 +1636,22 @@ int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, cons
return send_message(d->bus, isempty(d->name) ? NULL : d->name, userdata);
}
+ ret = 0;
+
/* Send to everybody */
SET_FOREACH(b, m->private_buses, i) {
r = send_message(b, NULL, userdata);
if (r < 0)
- return r;
+ ret = r;
}
- if (m->api_bus)
- return send_message(m->api_bus, NULL, userdata);
+ if (m->api_bus) {
+ r = send_message(m->api_bus, NULL, userdata);
+ if (r < 0)
+ ret = r;
+ }
- return 0;
+ return ret;
}
static int send_finished(sd_bus *bus, const char *destination, void *userdata) {
@@ -1668,7 +1673,7 @@ static int send_finished(sd_bus *bus, const char *destination, void *userdata) {
return sd_bus_send_to(bus, message, destination, NULL);
}
-int bus_manager_send_finished(
+void bus_manager_send_finished(
Manager *m,
usec_t firmware_usec,
usec_t loader_usec,
@@ -1677,10 +1682,14 @@ int bus_manager_send_finished(
usec_t userspace_usec,
usec_t total_usec) {
+ int r;
+
assert(m);
- return bus_manager_foreach_client(m, send_finished,
- (usec_t[6]) { firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec });
+ r = bus_manager_foreach_client(m, send_finished,
+ (usec_t[6]) { firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec });
+ if (r < 0)
+ log_debug("Failed to send finished signal: %s", strerror(-r));
}
static int send_reloading(sd_bus *bus, const char *destination, void *userdata) {
@@ -1700,8 +1709,13 @@ static int send_reloading(sd_bus *bus, const char *destination, void *userdata)
return sd_bus_send_to(bus, message, destination, NULL);
}
-int bus_manager_send_reloading(Manager *m, bool active) {
+void bus_manager_send_reloading(Manager *m, bool active) {
+ int r;
+
assert(m);
- return bus_manager_foreach_client(m, send_reloading, INT_TO_PTR(active));
+ r = bus_manager_foreach_client(m, send_reloading, INT_TO_PTR(active));
+ if (r < 0)
+ log_debug("Failed to send reloading signal: %s", strerror(-r));
+
}
diff --git a/src/core/dbus-manager.h b/src/core/dbus-manager.h
index ad451eb..0ef99fa 100644
--- a/src/core/dbus-manager.h
+++ b/src/core/dbus-manager.h
@@ -28,5 +28,5 @@ extern const sd_bus_vtable bus_manager_vtable[];
int bus_manager_foreach_client(Manager *m, int (*send_message)(sd_bus *bus, const char *destination, void *userdata), void *userdata);
-int bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
-int bus_manager_send_reloading(Manager *m, bool active);
+void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
+void bus_manager_send_reloading(Manager *m, bool active);
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 975fc46..3c25c36 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -664,7 +664,6 @@ static int send_changed_signal(sd_bus *bus, const char *destination, void *userd
void bus_unit_send_change_signal(Unit *u) {
int r;
-
assert(u);
if (u->in_dbus_queue) {
@@ -677,7 +676,7 @@ void bus_unit_send_change_signal(Unit *u) {
r = bus_manager_foreach_client(u->manager, u->sent_dbus_new_signal ? send_changed_signal : send_new_signal, u);
if (r < 0)
- log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+ log_debug("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
u->sent_dbus_new_signal = true;
}
@@ -713,7 +712,6 @@ static int send_removed_signal(sd_bus *bus, const char *destination, void *userd
void bus_unit_send_removed_signal(Unit *u) {
int r;
-
assert(u);
if (!u->sent_dbus_new_signal)
@@ -724,7 +722,7 @@ void bus_unit_send_removed_signal(Unit *u) {
r = bus_manager_foreach_client(u->manager, send_removed_signal, u);
if (r < 0)
- log_warning("Failed to send unit change signal for %s: %s", u->id, strerror(-r));
+ log_debug("Failed to send unit remove signal for %s: %s", u->id, strerror(-r));
}
int bus_unit_queue_job(
More information about the systemd-commits
mailing list