[systemd-commits] 8 commits - TODO src/bus-proxyd src/core src/libsystemd src/systemctl units/rc-local.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Dec 2 04:23:09 PST 2014
TODO | 11 +++++++++++
src/bus-proxyd/bus-proxyd.c | 2 +-
src/core/dbus-unit.c | 26 +++++++++++++++++++++++++-
src/core/dbus.c | 9 +++++++--
src/core/manager.c | 23 +++++++++++++++--------
src/core/unit.c | 12 ++++++++++++
src/core/unit.h | 4 +++-
src/libsystemd/sd-bus/busctl.c | 3 ++-
src/systemctl/systemctl.c | 8 +++++++-
units/rc-local.service.in | 1 -
10 files changed, 83 insertions(+), 16 deletions(-)
New commits:
commit e3286870fdf20c3c93e944b24fd9af53620f7dba
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 13:22:47 2014 +0100
update TODO
diff --git a/TODO b/TODO
index bca4ff2..20591e3 100644
--- a/TODO
+++ b/TODO
@@ -35,6 +35,15 @@ External:
Features:
+* the install state probably shouldn't get confused by generated units, think dbus1/kdbus compat!
+
+* revisit rfkill. the rfkill device names are counted up, and not stable. instead: store per kind of device together with PCI path, ignore the device name.
+
+* in systemctl list-unit-files: show the install value the presets would suggest for a service in a third column
+
+* we should try harder to collapse start jobs for swaps that end up being the same:
+ http://lists.freedesktop.org/archives/systemd-devel/2014-November/025359.html
+
* timedated should compensate on SetTime for the time spent in polkit
* figure out what to do with libmount and utab?
commit 92ac127007335e804d7ae1b9439469a162089975
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 13:08:10 2014 +0100
rc-local: drop SysVStartPriority= field which is now obsolete
diff --git a/units/rc-local.service.in b/units/rc-local.service.in
index 97d44a7..d4db174 100644
--- a/units/rc-local.service.in
+++ b/units/rc-local.service.in
@@ -17,4 +17,3 @@ Type=forking
ExecStart=@RC_LOCAL_SCRIPT_PATH_START@ start
TimeoutSec=0
RemainAfterExit=yes
-SysVStartPriority=99
commit c9a267b1b7009065a67dbf2c638b03c6801f7bbe
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 12:58:44 2014 +0100
bus-proxy: don't log bus policy every single time we run
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index 8fb204c..2e34cc9 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -1400,7 +1400,7 @@ int main(int argc, char *argv[]) {
}
policy = &policy_buffer;
- policy_dump(policy);
+ /* policy_dump(policy); */
if (!policy_check_hello(policy, ucred.uid, ucred.gid)) {
r = log_error_errno(EPERM, "Policy denied connection.");
commit 1ed24c6170c95fbe61fed919db2e98cf0d1d568e
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 12:58:13 2014 +0100
busctl: fix 'command line' style output of properties
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 1ba4e8a..dd6ae86 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -538,7 +538,7 @@ static int format_cmdline(sd_bus_message *m, FILE *f, bool needs_space) {
fprintf(f, "%s", contents);
}
- r = format_cmdline(m, f, true);
+ r = format_cmdline(m, f, needs_space || IN_SET(type, SD_BUS_TYPE_ARRAY, SD_BUS_TYPE_VARIANT));
if (r < 0)
return r;
@@ -614,6 +614,7 @@ static int format_cmdline(sd_bus_message *m, FILE *f, bool needs_space) {
assert_not_reached("Unknown basic type.");
}
+ needs_space = true;
}
}
commit d2dc52dbc45051faa6356213a537081084e9dda4
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 02:38:18 2014 +0100
systemctl: show unit file preset state in "systemctl status" output"
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 36b68ae..cc09a26 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -169,6 +169,29 @@ static int property_get_sub_state(
return sd_bus_message_append(reply, "s", unit_sub_state_to_string(u));
}
+static int property_get_unit_file_preset(
+ sd_bus *bus,
+ const char *path,
+ const char *interface,
+ const char *property,
+ sd_bus_message *reply,
+ void *userdata,
+ sd_bus_error *error) {
+
+ Unit *u = userdata;
+ int r;
+
+ assert(bus);
+ assert(reply);
+ assert(u);
+
+ r = unit_get_unit_file_preset(u);
+
+ return sd_bus_message_append(reply, "s",
+ r < 0 ? "":
+ r > 0 ? "enabled" : "disabled");
+}
+
static int property_get_unit_file_state(
sd_bus *bus,
const char *path,
@@ -184,7 +207,7 @@ static int property_get_unit_file_state(
assert(reply);
assert(u);
- return sd_bus_message_append(reply, "s", unit_file_state_to_string(unit_get_unit_file_state(u)));
+ return sd_bus_message_append(reply, "s", unit_file_state_to_string(unit_get_unit_file_preset(u)));
}
static int property_get_can_start(
@@ -552,6 +575,7 @@ const sd_bus_vtable bus_unit_vtable[] = {
SD_BUS_PROPERTY("SourcePath", "s", NULL, offsetof(Unit, source_path), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("DropInPaths", "as", NULL, offsetof(Unit, dropin_paths), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("UnitFileState", "s", property_get_unit_file_state, 0, 0),
+ SD_BUS_PROPERTY("UnitFilePreset", "s", property_get_unit_file_preset, 0, 0),
BUS_PROPERTY_DUAL_TIMESTAMP("InactiveExitTimestamp", offsetof(Unit, inactive_exit_timestamp), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
BUS_PROPERTY_DUAL_TIMESTAMP("ActiveEnterTimestamp", offsetof(Unit, active_enter_timestamp), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
BUS_PROPERTY_DUAL_TIMESTAMP("ActiveExitTimestamp", offsetof(Unit, active_exit_timestamp), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
diff --git a/src/core/unit.c b/src/core/unit.c
index 9df398a..7daf170 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -92,6 +92,7 @@ Unit *unit_new(Manager *m, size_t size) {
u->deserialized_job = _JOB_TYPE_INVALID;
u->default_dependencies = true;
u->unit_file_state = _UNIT_FILE_STATE_INVALID;
+ u->unit_file_preset = -1;
u->on_failure_job_mode = JOB_REPLACE;
return u;
@@ -3090,6 +3091,17 @@ UnitFileState unit_get_unit_file_state(Unit *u) {
return u->unit_file_state;
}
+int unit_get_unit_file_preset(Unit *u) {
+ assert(u);
+
+ if (u->unit_file_preset < 0 && u->fragment_path)
+ u->unit_file_preset = unit_file_query_preset(
+ u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
+ NULL, basename(u->fragment_path));
+
+ return u->unit_file_preset;
+}
+
Unit* unit_ref_set(UnitRef *ref, Unit *u) {
assert(ref);
assert(u);
diff --git a/src/core/unit.h b/src/core/unit.h
index 1b13ca8..0e45229 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -179,8 +179,9 @@ struct Unit {
/* Error code when we didn't manage to load the unit (negative) */
int load_error;
- /* Cached unit file state */
+ /* Cached unit file state and preset */
UnitFileState unit_file_state;
+ int unit_file_preset;
/* Counterparts in the cgroup filesystem */
char *cgroup_path;
@@ -560,6 +561,7 @@ void unit_start_on_failure(Unit *u);
void unit_trigger_notify(Unit *u);
UnitFileState unit_get_unit_file_state(Unit *u);
+int unit_get_unit_file_preset(Unit *u);
Unit* unit_ref_set(UnitRef *ref, Unit *u);
void unit_ref_unset(UnitRef *ref);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3f5bcdd..74af772 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3221,6 +3221,7 @@ typedef struct UnitStatusInfo {
const char *active_state;
const char *sub_state;
const char *unit_file_state;
+ const char *unit_file_preset;
const char *description;
const char *following;
@@ -3344,7 +3345,10 @@ static void print_status_info(
if (i->load_error)
printf(" Loaded: %s%s%s (Reason: %s)\n",
on, strna(i->load_state), off, i->load_error);
- else if (path && i->unit_file_state)
+ else if (path && !isempty(i->unit_file_state) && !isempty(i->unit_file_preset))
+ printf(" Loaded: %s%s%s (%s; %s; vendor preset: %s)\n",
+ on, strna(i->load_state), off, path, i->unit_file_state, i->unit_file_preset);
+ else if (path && !isempty(i->unit_file_state))
printf(" Loaded: %s%s%s (%s; %s)\n",
on, strna(i->load_state), off, path, i->unit_file_state);
else if (path)
@@ -3669,6 +3673,8 @@ static int status_property(const char *name, sd_bus_message *m, UnitStatusInfo *
i->following = s;
else if (streq(name, "UnitFileState"))
i->unit_file_state = s;
+ else if (streq(name, "UnitFilePreset"))
+ i->unit_file_preset = s;
else if (streq(name, "Result"))
i->result = s;
}
commit e5035a2778b7ed2a8ac901521ed47cf079359e68
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 00:19:05 2014 +0100
manager: log deserialization errors only at LOG_DEBUG level
During upgrades and when transitioning between different systemd
versions in initrd and on the host we have to expect that some
serialization fields are unknown or parse incorrectly. This shouldn't
really be considered an error, hence downgrade the log messages about
it to debug. This way we can still trace it, but it doesn't confuse
users.
This kinda reverts 46849c3f.
diff --git a/src/core/manager.c b/src/core/manager.c
index 5fbb375..cff24fa 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2289,7 +2289,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
uint32_t id;
if (safe_atou32(l+15, &id) < 0)
- log_warning("Failed to parse current job id value %s", l+15);
+ log_debug("Failed to parse current job id value %s", l+15);
else
m->current_job_id = MAX(m->current_job_id, id);
@@ -2297,7 +2297,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
uint32_t n;
if (safe_atou32(l+17, &n) < 0)
- log_warning("Failed to parse installed jobs counter %s", l+17);
+ log_debug("Failed to parse installed jobs counter %s", l+17);
else
m->n_installed_jobs += n;
@@ -2305,7 +2305,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
uint32_t n;
if (safe_atou32(l+14, &n) < 0)
- log_warning("Failed to parse failed jobs counter %s", l+14);
+ log_debug("Failed to parse failed jobs counter %s", l+14);
else
m->n_failed_jobs += n;
@@ -2314,7 +2314,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
b = parse_boolean(l+10);
if (b < 0)
- log_warning("Failed to parse taint /usr flag %s", l+10);
+ log_debug("Failed to parse taint /usr flag %s", l+10);
else
m->taint_usr = m->taint_usr || b;
@@ -2365,7 +2365,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
int fd;
if (safe_atoi(l + 10, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_warning("Failed to parse notify fd: %s", l + 10);
+ log_debug("Failed to parse notify fd: %s", l + 10);
else {
m->notify_event_source = sd_event_source_unref(m->notify_event_source);
safe_close(m->notify_fd);
@@ -2388,7 +2388,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
int fd;
if (safe_atoi(l + 9, &fd) < 0 || fd < 0 || !fdset_contains(fds, fd))
- log_warning("Failed to parse kdbus fd: %s", l + 9);
+ log_debug("Failed to parse kdbus fd: %s", l + 9);
else {
safe_close(m->kdbus_fd);
m->kdbus_fd = fdset_remove(fds, fd);
commit a195cbad3796dfda3d1016e4819c612c859e3c7b
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 00:16:14 2014 +0100
update TODO
diff --git a/TODO b/TODO
index a26f3e2..bca4ff2 100644
--- a/TODO
+++ b/TODO
@@ -35,6 +35,8 @@ External:
Features:
+* timedated should compensate on SetTime for the time spent in polkit
+
* figure out what to do with libmount and utab?
* We really should have a FOREACH macro to iterate through inotify events we read, similar to KDBUS_FOREACH_ITEM
commit 230314d718cb68b328961c9723976e54c17d06f7
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Dec 2 00:15:13 2014 +0100
core: OOM really shouldn't be considered a deserialization parse failure
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 79cf414..87da933 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1144,15 +1144,20 @@ void bus_track_serialize(sd_bus_track *t, FILE *f) {
int bus_track_deserialize_item(char ***l, const char *line) {
const char *e;
+ int r;
assert(l);
assert(line);
e = startswith(line, "subscribed=");
if (!e)
- return -EINVAL;
+ return 0;
+
+ r = strv_extend(l, e);
+ if (r < 0)
+ return r;
- return strv_extend(l, e);
+ return 1;
}
int bus_track_coldplug(Manager *m, sd_bus_track **t, char ***l) {
diff --git a/src/core/manager.c b/src/core/manager.c
index 7b25500..5fbb375 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2394,8 +2394,15 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
m->kdbus_fd = fdset_remove(fds, fd);
}
- } else if (bus_track_deserialize_item(&m->deserialized_subscribed, l) < 0)
- log_warning("Unknown serialization item '%s'", l);
+ } else {
+ int k;
+
+ k = bus_track_deserialize_item(&m->deserialized_subscribed, l);
+ if (k < 0)
+ log_debug_errno(k, "Failed to deserialize bus tracker object: %m");
+ else if (k == 0)
+ log_debug("Unknown serialization item '%s'", l);
+ }
}
for (;;) {
More information about the systemd-commits
mailing list