]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
notify: Add EXIT_STATUS field
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Apr 2023 09:56:00 +0000 (11:56 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 12 Apr 2023 13:02:34 +0000 (15:02 +0200)
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
src/shared/main-func.h

index 39bddc9d15ed0bf970dfe747a7a0e05f98d63c6a..f93542e329be7d3672812126750870b642cd4013 100644 (file)
         <literal>BUSERROR=org.freedesktop.DBus.Error.TimedOut</literal></para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>EXIT_STATUS=…</term>
+
+        <listitem><para>If a service exits, the return value of its <function>main()</function> function.
+        </para></listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>MAINPID=…</term>
 
index 3dc49922821a57260e1a000370bdd30bc658a362..3f6b6a849d2d2f35d6b79fb9ae1d2db0384b6e40 100644 (file)
@@ -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();                                          \