From: Miguel Angel Ajo <mangel...@redhat.com> --- src/core/dbus-service.c | 1 + src/core/service.c | 19 +++++++++++++++++++ src/core/service.h | 1 + 3 files changed, 21 insertions(+)
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 093289f..5a881e8 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -60,6 +60,7 @@ const sd_bus_vtable bus_service_vtable[] = { SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Service, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("BusName", "s", NULL, offsetof(Service, bus_name), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("StatusText", "s", NULL, offsetof(Service, status_text), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("StatusErrno", "i", NULL, offsetof(Service, status_errno), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Service, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_EXEC_STATUS_VTABLE("ExecMain", offsetof(Service, main_exec_status), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), BUS_EXEC_COMMAND_LIST_VTABLE("ExecStartPre", offsetof(Service, exec_command[SERVICE_EXEC_START_PRE]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), diff --git a/src/core/service.c b/src/core/service.c index 10dc79c..68a98f8 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2565,6 +2565,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { Service *s = SERVICE(u); const char *e; bool notify_dbus = false; + int status_errno; assert(u); @@ -2604,6 +2605,24 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) { } } + /* Interpret ERRNO= */ + if ((e = strv_find_prefix(tags, "ERRNO=")) && + (s->state == SERVICE_START || + s->state == SERVICE_START_POST || + s->state == SERVICE_RUNNING || + s->state == SERVICE_RELOAD)) { + + if (safe_atoi(e + 6, &status_errno) < 0) + log_warning_unit(u->id, + "Failed to parse notification message %s", e); + else { + log_debug_unit(u->id, + "%s: got %s", u->id, e); + s->status_errno = status_errno; + notify_dbus = true; + } + } + /* Interpret READY= */ if (s->type == SERVICE_NOTIFY && s->state == SERVICE_START && strv_find(tags, "READY=1")) { log_debug_unit(u->id, "%s: got READY=1", u->id); diff --git a/src/core/service.h b/src/core/service.h index b8f0e0c..d75abdc 100644 --- a/src/core/service.h +++ b/src/core/service.h @@ -181,6 +181,7 @@ struct Service { char *bus_name; char *status_text; + int status_errno; FailureAction failure_action; -- 1.9.3 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel