From 623a00020f116d8e9c70608a9e4f7cc978342441 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 12 Apr 2023 11:56:00 +0200 Subject: [PATCH] notify: Add EXIT_STATUS field Whenever one of our tools or daemons exits, let's send the exit status via sd-notify in the EXIT_STATUS field. --- man/sd_notify.xml | 7 +++++++ src/shared/main-func.h | 1 + 2 files changed, 8 insertions(+) diff --git a/man/sd_notify.xml b/man/sd_notify.xml index 39bddc9d15e..f93542e329b 100644 --- a/man/sd_notify.xml +++ b/man/sd_notify.xml @@ -170,6 +170,13 @@ BUSERROR=org.freedesktop.DBus.Error.TimedOut + + EXIT_STATUS=… + + If a service exits, the return value of its main() function. + + + MAINPID=… diff --git a/src/shared/main-func.h b/src/shared/main-func.h index 3dc49922821..3f6b6a849d2 100644 --- a/src/shared/main-func.h +++ b/src/shared/main-func.h @@ -21,6 +21,7 @@ r = impl; \ if (r < 0) \ (void) sd_notifyf(0, "ERRNO=%i", -r); \ + (void) sd_notifyf(0, "EXIT_STATUS=%i", ret); \ ask_password_agent_close(); \ polkit_agent_close(); \ pager_close(); \ -- 2.47.3