[systemd-commits] 4 commits - src/core src/libsystemd-bus src/shared
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Dec 23 09:19:31 PST 2013
src/core/main.c | 1 -
src/libsystemd-bus/bus-objects.c | 11 ++++++++---
src/libsystemd-bus/sd-bus.c | 6 ++++++
src/shared/log.c | 17 +++++++++++++++++
src/shared/util.c | 16 ++++++++++++++--
5 files changed, 45 insertions(+), 6 deletions(-)
New commits:
commit 02bb6cda87189ce0be10e8daba5c781f5eb90634
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 23 18:10:57 2013 +0100
util: when we try to read /proc/cmdline in a container, read /proc/1/cmdline instead
diff --git a/src/shared/util.c b/src/shared/util.c
index 5c9d0bb..8d7cf53 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5994,8 +5994,20 @@ int proc_cmdline(char **ret) {
int r;
if (detect_container(NULL) > 0) {
- *ret = NULL;
- return 0;
+ char *buf, *p;
+ size_t sz = 0;
+
+ r = read_full_file("/proc/1/cmdline", &buf, &sz);
+ if (r < 0)
+ return r;
+
+ for (p = buf; p + 1 < buf + sz; p++)
+ if (*p == 0)
+ *p = ' ';
+
+ *p = 0;
+ *ret = buf;
+ return 1;
}
r = read_one_line_file("/proc/cmdline", ret);
commit b8d0ffc21f9c237cdeef49b1873b47df1a0a1543
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 23 17:56:44 2013 +0100
log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug"
diff --git a/src/core/main.c b/src/core/main.c
index 5189833..064445d 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -462,7 +462,6 @@ DEFINE_SETTER(config_parse_target, log_set_target_from_string, "target")
DEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" )
DEFINE_SETTER(config_parse_location, log_show_location_from_string, "location")
-
static int config_parse_cpu_affinity2(const char *unit,
const char *filename,
unsigned line,
diff --git a/src/shared/log.c b/src/shared/log.c
index 268f034..2a075ff 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -879,7 +879,24 @@ int log_set_max_level_from_string(const char *e) {
}
void log_parse_environment(void) {
+ _cleanup_free_ char *line = NULL;
const char *e;
+ int r;
+
+ r = proc_cmdline(&line);
+ if (r < 0)
+ log_warning("Failed to read /proc/cmdline. Ignoring: %s", strerror(-r));
+ else if (r > 0) {
+ char *w, *state;
+ size_t l;
+
+ FOREACH_WORD_QUOTED(w, l, line, state) {
+ if (l == 5 && startswith(w, "debug")) {
+ log_set_max_level(LOG_DEBUG);
+ break;
+ }
+ }
+ }
e = secure_getenv("SYSTEMD_LOG_TARGET");
if (e && log_set_target_from_string(e) < 0)
commit 46525bfc020e06609a44670f277aaf23954e7d85
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 23 17:30:21 2013 +0100
bus: make sure sd_bus_emit_properties_changed_strv() doesn't return ENOENT if no properties with a change flag are in the interface
diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c
index 30f6124..b116a5d 100644
--- a/src/libsystemd-bus/bus-objects.c
+++ b/src/libsystemd-bus/bus-objects.c
@@ -1981,6 +1981,7 @@ static int emit_properties_changed_on_interface(
const char *path,
const char *interface,
bool require_fallback,
+ bool *found_interface,
char **names) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -1997,6 +1998,7 @@ static int emit_properties_changed_on_interface(
assert(prefix);
assert(path);
assert(interface);
+ assert(found_interface);
n = hashmap_get(bus->nodes, prefix);
if (!n)
@@ -2032,6 +2034,8 @@ static int emit_properties_changed_on_interface(
if (r == 0)
continue;
+ *found_interface = true;
+
if (names) {
/* If the caller specified a list of
* properties we include exactly those in the
@@ -2185,6 +2189,7 @@ _public_ int sd_bus_emit_properties_changed_strv(
char **names) {
BUS_DONT_DESTROY(bus);
+ bool found_interface = false;
char *prefix;
int r;
@@ -2205,7 +2210,7 @@ _public_ int sd_bus_emit_properties_changed_strv(
do {
bus->nodes_modified = false;
- r = emit_properties_changed_on_interface(bus, path, path, interface, false, names);
+ r = emit_properties_changed_on_interface(bus, path, path, interface, false, &found_interface, names);
if (r != 0)
return r;
if (bus->nodes_modified)
@@ -2213,7 +2218,7 @@ _public_ int sd_bus_emit_properties_changed_strv(
prefix = alloca(strlen(path) + 1);
OBJECT_PATH_FOREACH_PREFIX(prefix, path) {
- r = emit_properties_changed_on_interface(bus, prefix, path, interface, true, names);
+ r = emit_properties_changed_on_interface(bus, prefix, path, interface, true, &found_interface, names);
if (r != 0)
return r;
if (bus->nodes_modified)
@@ -2222,7 +2227,7 @@ _public_ int sd_bus_emit_properties_changed_strv(
} while (bus->nodes_modified);
- return -ENOENT;
+ return found_interface ? 0 : -ENOENT;
}
_public_ int sd_bus_emit_properties_changed(
commit dc74ce9b4a49ab31383d00b30406bc225b2cc8ed
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Dec 23 17:18:30 2013 +0100
bus: write debug message when we get a method call we cannot handle
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index ee62b34..9dfb6e4 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -2171,6 +2171,12 @@ static int process_running(sd_bus *bus, sd_bus_message **ret) {
if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL) {
+ log_debug("Unprocessed message call sender=%s object=%s interface=%s member=%s",
+ strna(sd_bus_message_get_sender(m)),
+ strna(sd_bus_message_get_path(m)),
+ strna(sd_bus_message_get_interface(m)),
+ strna(sd_bus_message_get_member(m)));
+
r = sd_bus_reply_method_errorf(
m,
SD_BUS_ERROR_UNKNOWN_OBJECT,
More information about the systemd-commits
mailing list