[systemd-commits] 4 commits - TODO src/analyze src/hostname src/libsystemd-bus src/locale src/login src/machine src/nspawn src/timedate src/update-utmp
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Nov 7 21:41:24 CET 2013
TODO | 2 ++
src/analyze/analyze.c | 27 ++++++++++++---------------
src/hostname/hostnamectl.c | 10 +++++-----
src/libsystemd-bus/bus-util.c | 5 +++++
src/libsystemd-bus/bus-util.h | 2 ++
src/libsystemd-bus/busctl.c | 4 ++--
src/locale/localectl.c | 4 ++--
src/login/inhibit.c | 2 +-
src/login/loginctl.c | 23 +++++++++--------------
src/machine/machinectl.c | 40 +++++++++++++---------------------------
src/nspawn/nspawn.c | 6 ++----
src/timedate/timedatectl.c | 6 +++---
src/update-utmp/update-utmp.c | 17 ++++++-----------
13 files changed, 64 insertions(+), 84 deletions(-)
New commits:
commit 6cc532fdccac8eff638da94fbcce0bb655e4689e
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 7 21:41:06 2013 +0100
update TODO
diff --git a/TODO b/TODO
index 29dc721..eb1a9d1 100644
--- a/TODO
+++ b/TODO
@@ -46,6 +46,8 @@ CGroup Rework Completion:
Features:
+* journalctl: support -M to read journal of containers and determine journal directory from root directory of container
+
* tmpfiles: to make sure we don't delete unpacked tarballs with old timestamps right-away never delete stuff that is inside a directory with a new mtime
* "systemctl mask" should find all names by which a unit is accessible
commit a86a47ce1f63476631635fbcbc10af8877172114
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 7 21:31:13 2013 +0100
clients: try to follow roughly the same order in --help texts for common options
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 715ad73..4637424 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1157,6 +1157,7 @@ static int help(void) {
"Process systemd profiling information.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
+ " --no-pager Do not pipe output into a pager\n"
" --system Connect to system manager\n"
" --user Connect to user manager\n"
" -H --host=[USER@]HOST Operate on remote host\n"
@@ -1169,8 +1170,7 @@ static int help(void) {
" --fuzz=TIMESPAN When printing the tree of the critical chain, print also\n"
" services, which finished TIMESPAN earlier, than the\n"
" latest in the branch. The unit of TIMESPAN is seconds\n"
- " unless specified with a different unit, i.e. 50ms\n"
- " --no-pager Do not pipe output into a pager\n\n"
+ " unless specified with a different unit, i.e. 50ms\n\n"
"Commands:\n"
" time Print time spent in the kernel before reaching userspace\n"
" blame Print list of running units ordered by time to init\n"
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 959ec6d..3e51778 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -294,12 +294,12 @@ static int help(void) {
"Query or change system hostname.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
- " --transient Only set transient hostname\n"
- " --static Only set static hostname\n"
- " --pretty Only set pretty hostname\n"
" --no-ask-password Do not prompt for password\n"
" -H --host=[USER@]HOST Operate on remote host\n"
- " -M --machine=CONTAINER Operate on local container\n\n"
+ " -M --machine=CONTAINER Operate on local container\n"
+ " --transient Only set transient hostname\n"
+ " --static Only set static hostname\n"
+ " --pretty Only set pretty hostname\n\n"
"Commands:\n"
" status Show current hostname settings\n"
" set-hostname NAME Set system hostname\n"
diff --git a/src/libsystemd-bus/busctl.c b/src/libsystemd-bus/busctl.c
index 717b911..895dd03 100644
--- a/src/libsystemd-bus/busctl.c
+++ b/src/libsystemd-bus/busctl.c
@@ -183,14 +183,14 @@ static int help(void) {
"Introspect the bus.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
+ " --no-pager Do not pipe output into a pager\n"
" --system Connect to system bus\n"
" --user Connect to user bus\n"
" -H --host=[USER@]HOST Operate on remote host\n"
" -M --machine=CONTAINER Operate on local container\n"
" --address=ADDRESS Connect to bus specified by address\n"
" --no-unique Only show well-known names\n"
- " --match=MATCH Only show matching messages\n"
- " --no-pager Do not pipe output into a pager\n\n"
+ " --match=MATCH Only show matching messages\n\n"
"Commands:\n"
" list List bus names\n"
" monitor [SERVICE...] Show bus traffic\n",
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 748a148..31deb67 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -617,11 +617,11 @@ static int help(void) {
"Query or change system locale and keyboard settings.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
- " --no-convert Don't convert keyboard mappings\n"
" --no-pager Do not pipe output into a pager\n"
" --no-ask-password Do not prompt for password\n"
" -H --host=[USER@]HOST Operate on remote host\n"
- " -M --machine=CONTAINER Operate on local container\n\n"
+ " -M --machine=CONTAINER Operate on local container\n"
+ " --no-convert Don't convert keyboard mappings\n\n"
"Commands:\n"
" status Show current locale settings\n"
" set-locale LOCALE... Set system locale\n"
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 54b39a1..2267733 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -413,12 +413,12 @@ static int help(void) {
"Query or change system time and date settings.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
- " --adjust-system-clock\n"
- " Adjust system clock when changing local RTC mode\n"
" --no-pager Do not pipe output into a pager\n"
" --no-ask-password Do not prompt for password\n"
" -H --host=[USER@]HOST Operate on remote host\n"
- " -M --machine=CONTAINER Operate on local container\n\n"
+ " -M --machine=CONTAINER Operate on local container\n"
+ " --adjust-system-clock\n"
+ " Adjust system clock when changing local RTC mode\n\n"
"Commands:\n"
" status Show current time settings\n"
" set-time TIME Set system time\n"
commit 74c7b1ed052fc42d9841a5d83d310fa96124c47c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 7 21:28:15 2013 +0100
machinectl: show list headers even if we pipe, since that appears to be the usual way
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 7feb7be..4b8351c 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -84,8 +84,7 @@ static int list_machines(sd_bus *bus, char **args, unsigned n) {
return r;
}
- if (on_tty())
- printf("%-32s %-9s %-16s\n", "MACHINE", "CONTAINER", "SERVICE");
+ printf("%-32s %-9s %-16s\n", "MACHINE", "CONTAINER", "SERVICE");
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssso)");
if (r < 0)
@@ -103,8 +102,7 @@ static int list_machines(sd_bus *bus, char **args, unsigned n) {
if (r < 0)
return bus_log_parse_error(r);
- if (on_tty())
- printf("\n%u machines listed.\n", k);
+ printf("\n%u machines listed.\n", k);
return 0;
}
commit 5b30bef856e89a571df57b7b953e9a1409d9aced
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 7 21:26:31 2013 +0100
bus: log message parsing errors everywhere with a generalized bus_log_parse_error()
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 22bf076..715ad73 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -190,10 +190,8 @@ static int bus_parse_unit_info(sd_bus_message *message, struct unit_info *u) {
&u->job_id,
&u->job_type,
&u->job_path);
- if (r < 0) {
- log_error("Failed to parse message as unit_info.");
- return -EIO;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
return r;
}
@@ -230,6 +228,9 @@ static int bus_get_unit_property_strv(sd_bus *bus, const char *unit_path, const
}
}
+ if (r < 0)
+ return bus_log_parse_error(r);
+
return r;
}
@@ -839,15 +840,13 @@ static int list_dependencies(sd_bus *bus, const char *name) {
&reply,
"s");
if (r < 0) {
- log_error("Failed to parse reply: %s", bus_error_message(&error, -r));
+ log_error("Failed to get ID: %s", bus_error_message(&error, -r));
return r;
}
r = sd_bus_message_read(reply, "s", &id);
- if (r < 0) {
- log_error("Failed to parse reply.");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
times = hashmap_get(unit_times_hashmap, id);
@@ -1114,10 +1113,8 @@ static int dump(sd_bus *bus, char **args) {
}
r = sd_bus_message_read(reply, "s", &text);
- if (r < 0) {
- log_error("Failed to parse reply");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
fputs(text, stdout);
return 0;
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 523177b..959ec6d 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -145,7 +145,7 @@ static int show_one_name(sd_bus *bus, const char* attr) {
r = sd_bus_message_read(reply, "s", &s);
if (r < 0)
- return r;
+ return bus_log_parse_error(r);
printf("%s\n", s);
diff --git a/src/libsystemd-bus/bus-util.c b/src/libsystemd-bus/bus-util.c
index 2b1cd0b..ae9733d 100644
--- a/src/libsystemd-bus/bus-util.c
+++ b/src/libsystemd-bus/bus-util.c
@@ -953,3 +953,8 @@ int bus_property_get_uid(
return sd_bus_message_append_basic(reply, 'u', userdata);
}
+
+int bus_log_parse_error(int r) {
+ log_error("Failed to parse message: %s", strerror(-r));
+ return r;
+}
diff --git a/src/libsystemd-bus/bus-util.h b/src/libsystemd-bus/bus-util.h
index f982e08..5f0a0b3 100644
--- a/src/libsystemd-bus/bus-util.h
+++ b/src/libsystemd-bus/bus-util.h
@@ -75,6 +75,8 @@ int bus_property_get_uid(sd_bus *bus, const char *path, const char *interface, c
#define bus_property_get_gid bus_property_get_uid
#define bus_property_get_pid bus_property_get_uid
+int bus_log_parse_error(int r);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref);
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 8c0056e..e20af74 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -62,7 +62,7 @@ static int inhibit(sd_bus *bus, sd_bus_error *error) {
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
if (r < 0)
- return -EIO;
+ return r;
r = dup(fd);
if (r < 0)
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index c9899ec..2aedbcf 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -72,11 +72,6 @@ static void polkit_agent_open_if_enabled(void) {
polkit_agent_open();
}
-static int log_parse_error(int r) {
- log_error("Failed to parse message: %s", strerror(-r));
- return r;
-}
-
static int list_sessions(sd_bus *bus, char **args, unsigned n) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
@@ -102,7 +97,7 @@ static int list_sessions(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(susso)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%10s %10s %-16s %-16s\n", "SESSION", "UID", "USER", "SEAT");
@@ -111,7 +106,7 @@ static int list_sessions(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u sessions listed.\n", k);
@@ -143,7 +138,7 @@ static int list_users(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(uso)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%10s %-16s\n", "UID", "USER");
@@ -152,7 +147,7 @@ static int list_users(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u users listed.\n", k);
@@ -183,7 +178,7 @@ static int list_seats(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, 'a', "(so)");
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("%-16s\n", "SEAT");
@@ -192,7 +187,7 @@ static int list_seats(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
printf("\n%u seats listed.\n", k);
@@ -622,7 +617,7 @@ static int show_session(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);
@@ -689,7 +684,7 @@ static int show_user(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);
@@ -749,7 +744,7 @@ static int show_seat(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_read(reply, "o", &path);
if (r < 0)
- return log_parse_error(r);
+ return bus_log_parse_error(r);
if (show_properties)
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, NULL, arg_all);
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index f60c660..7feb7be 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -89,7 +89,7 @@ static int list_machines(sd_bus *bus, char **args, unsigned n) {
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssso)");
if (r < 0)
- goto fail;
+ return bus_log_parse_error(r);
while ((r = sd_bus_message_read(reply, "(ssso)", &name, &class, &service, &object)) > 0) {
printf("%-32s %-9s %-16s\n", name, class, service);
@@ -97,20 +97,16 @@ static int list_machines(sd_bus *bus, char **args, unsigned n) {
k++;
}
if (r < 0)
- goto fail;
+ return bus_log_parse_error(r);
r = sd_bus_message_exit_container(reply);
if (r < 0)
- goto fail;
+ return bus_log_parse_error(r);
if (on_tty())
printf("\n%u machines listed.\n", k);
return 0;
-
-fail:
- log_error("Failed to parse reply: %s", strerror(-r));
- return r;
}
static int show_scope_cgroup(sd_bus *bus, const char *unit, pid_t leader) {
@@ -146,10 +142,8 @@ static int show_scope_cgroup(sd_bus *bus, const char *unit, pid_t leader) {
}
r = sd_bus_message_read(reply, "s", &cgroup);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
if (isempty(cgroup))
return 0;
@@ -334,10 +328,8 @@ static int show(sd_bus *bus, char **args, unsigned n) {
}
r = sd_bus_message_read(reply, "o", &path);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- break;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
if (properties)
r = show_properties(bus, path, &new_line);
@@ -547,10 +539,8 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
}
r = sd_bus_message_read(reply, "o", &path);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
r = sd_bus_get_property(
bus,
@@ -567,10 +557,8 @@ static int login_machine(sd_bus *bus, char **args, unsigned n) {
}
r = sd_bus_message_read(reply2, "u", &leader);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
master = openpt_in_namespace(leader, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY);
if (master < 0) {
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 34a0daf..06d627c 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -990,10 +990,8 @@ static int terminate_machine(pid_t pid) {
}
r = sd_bus_message_read(reply, "o", &path);
- if (r < 0) {
- log_error("Failed to parse GetMachineByPID() reply: %s", bus_error_message(&error, r));
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
r = sd_bus_call_method(
bus,
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index 61db1e9..42554fe 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -71,9 +71,8 @@ static usec_t get_startup_time(Context *c) {
}
r = sd_bus_message_read(reply, "v", "t", &t);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
return t;
}
@@ -123,10 +122,8 @@ static int get_current_runlevel(Context *c) {
}
r = sd_bus_message_read(reply1, "o", &path);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- return -EIO;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
r = sd_bus_call_method(
c->bus,
@@ -143,10 +140,8 @@ static int get_current_runlevel(Context *c) {
}
r = sd_bus_message_read(reply2, "v", "s", &state);
- if (r < 0) {
- log_error("Failed to parse reply: %s", strerror(-r));
- return -EIO;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
if (streq(state, "active") || streq(state, "reloading"))
return table[i].runlevel;
More information about the systemd-commits
mailing list