1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00

service: reorder sd_notify() handling a bit

Let's keep handling of WATCHDOG= and WATCHDOG_USEC= together. No
functional changes.
This commit is contained in:
Lennart Poettering 2017-11-13 18:06:09 +01:00
parent e328523777
commit c45d11cb30
3 changed files with 22 additions and 23 deletions

View File

@ -204,6 +204,14 @@
watchdog is enabled. </para></listitem>
</varlistentry>
<varlistentry>
<term>WATCHDOG_USEC=…</term>
<listitem><para>Reset <varname>watchdog_usec</varname> value during runtime.
Notice that this is not available when using <function>sd_event_set_watchdog()</function>
or <function>sd_watchdog_enabled()</function>.
Example : <literal>WATCHDOG_USEC=20000000</literal></para></listitem>
</varlistentry>
<varlistentry>
<term>FDSTORE=1</term>
@ -249,15 +257,6 @@
restrictions, it is ignored.</para></listitem>
</varlistentry>
<varlistentry>
<term>WATCHDOG_USEC=…</term>
<listitem><para>Reset <varname>watchdog_usec</varname> value during runtime.
Notice that this is not available when using <function>sd_event_set_watchdog()</function>
or <function>sd_watchdog_enabled()</function>.
Example : <literal>WATCHDOG_USEC=20000000</literal></para></listitem>
</varlistentry>
</variablelist>
<para>It is recommended to prefix variable names that are not

View File

@ -3457,6 +3457,15 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds)
if (strv_find(tags, "WATCHDOG=1"))
service_reset_watchdog(s);
e = strv_find_startswith(tags, "WATCHDOG_USEC=");
if (e) {
usec_t watchdog_override_usec;
if (safe_atou64(e, &watchdog_override_usec) < 0)
log_unit_warning(u, "Failed to parse WATCHDOG_USEC=%s", e);
else
service_reset_watchdog_timeout(s, watchdog_override_usec);
}
if (strv_find(tags, "FDSTORE=1")) {
const char *name;
@ -3469,15 +3478,6 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds)
service_add_fd_store_set(s, fds, name);
}
e = strv_find_startswith(tags, "WATCHDOG_USEC=");
if (e) {
usec_t watchdog_override_usec;
if (safe_atou64(e, &watchdog_override_usec) < 0)
log_unit_warning(u, "Failed to parse WATCHDOG_USEC=%s", e);
else
service_reset_watchdog_timeout(s, watchdog_override_usec);
}
/* Notify clients about changed status or main pid */
if (notify_dbus)
unit_add_to_dbus_queue(u);

View File

@ -204,17 +204,17 @@ int sd_is_mq(int fd, const char *path);
timestamps to detect failed services. Also see
sd_watchdog_enabled() below.
WATCHDOG_USEC=...
Reset watchdog_usec value during runtime.
To reset watchdog_usec value, start the service again.
Example: "WATCHDOG_USEC=20000000"
FDSTORE=1 Store the file descriptors passed along with the
message in the per-service file descriptor store,
and pass them to the main process again on next
invocation. This variable is only supported with
sd_pid_notify_with_fds().
WATCHDOG_USEC=...
Reset watchdog_usec value during runtime.
To reset watchdog_usec value, start the service again.
Example: "WATCHDOG_USEC=20000000"
Daemons can choose to send additional variables. However, it is
recommended to prefix variable names not listed above with X_.