summaryrefslogtreecommitdiff
path: root/src/core/service.c
diff options
context:
space:
mode:
authorMiguel Angel Ajo <mangelajo@redhat.com>2014-07-07 14:20:36 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-07 17:01:25 +0200
commit4774e357268e4a1e9fa82adb0563a538932a4c8e (patch)
tree79d18b43c972713174d32b57ab7e424a73a4a5ae /src/core/service.c
parent3250929b7049f3fbbb610a92438c8a8b638ec155 (diff)
core: Added support for ERRNO NOTIFY_SOCKET message parsing, and added StatusErrno dbus property along StatusText to allow notification of numeric status condition while degraded service operation or any other special situation.
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 0b19767d9e..ace45e29ec 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2637,6 +2637,23 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
free(t);
}
+ /* Interpret ERRNO= */
+ e = strv_find_prefix(tags, "ERRNO=");
+ if (e) {
+ int status_errno;
+
+ if (safe_atoi(e + 6, &status_errno) < 0)
+ log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
+ else {
+ log_debug_unit(u->id, "%s: got %s", u->id, e);
+
+ if (s->status_errno != status_errno) {
+ s->status_errno = status_errno;
+ notify_dbus = true;
+ }
+ }
+ }
+
/* Interpret WATCHDOG= */
if (strv_find(tags, "WATCHDOG=1")) {
log_debug_unit(u->id, "%s: got WATCHDOG=1", u->id);