1SD_EVENT_SET_WATCHDOG(3)     sd_event_set_watchdog    SD_EVENT_SET_WATCHDOG(3)
2
3
4

NAME

6       sd_event_set_watchdog, sd_event_get_watchdog - Enable event loop
7       watchdog support
8

SYNOPSIS

10       #include <systemd/sd-event.h>
11
12       int sd_event_set_watchdog(sd_event *event, int b);
13
14       int sd_event_get_watchdog(sd_event *event);
15

DESCRIPTION

17       sd_event_set_watchdog() may be used to enable or disable automatic
18       watchdog notification support in the event loop object specified in the
19       event parameter. Specifically, depending on the b boolean argument this
20       will make sure the event loop wakes up in regular intervals and sends
21       watchdog notification messages to the service manager, if this was
22       requested by the service manager. Watchdog support is determined with
23       sd_watchdog_enabled(3), and watchdog messages are sent with
24       sd_notify(3). See the WatchdogSec= setting in systemd.service(5) for
25       details on how to enable watchdog support for a service and the
26       protocol used. The wake-up interval is chosen as half the watchdog
27       timeout declared by the service manager via the $WATCHDOG_USEC
28       environment variable. If the service manager did not request watchdog
29       notifications, or if the process was not invoked by the service manager
30       this call with a true b parameter executes no operation. Passing a
31       false b parameter will disable the automatic sending of watchdog
32       notification messages if it was enabled before. Newly allocated event
33       loop objects have this feature disabled.
34
35       The first watchdog notification message is sent immediately when
36       set_event_set_watchdog() is invoked with a true b parameter.
37
38       The watchdog logic is designed to allow the service manager to
39       automatically detect services that ceased processing of incoming
40       events, and thus appear "hung". Watchdog notifications are sent out
41       only at the beginning of each event loop iteration. If an event source
42       dispatch function blocks for an excessively long time and does not
43       return execution to the event loop quickly, this might hence cause the
44       notification message to be delayed, and possibly result in abnormal
45       program termination, as configured in the service unit file.
46
47       sd_event_get_watchdog() may be used to determine whether watchdog
48       support was previously requested by a call to sd_event_set_watchdog()
49       with a true b parameter and successfully enabled.
50

RETURN VALUE

52       On success, sd_event_set_watchdog() and sd_event_get_watchdog() return
53       a non-zero positive integer if the service manager requested watchdog
54       support and watchdog support was successfully enabled. They return zero
55       if the service manager did not request watchdog support, or if watchdog
56       support was explicitly disabled with a false b parameter. On failure,
57       they return a negative errno-style error code.
58

ERRORS

60       Returned errors may indicate the following problems:
61
62       -ECHILD
63           The event loop has been created in a different process.
64
65       -EINVAL
66           The passed event loop object was invalid.
67

NOTES

69       These APIs are implemented as a shared library, which can be compiled
70       and linked to with the libsystemd pkg-config(1) file.
71

SEE ALSO

73       systemd(1), sd-event(3), sd_event_new(3), sd_event_add_io(3),
74       sd_event_add_time(3), sd_event_add_signal(3), sd_event_add_child(3),
75       sd_event_add_inotify(3), sd_event_add_defer(3), sd_watchdog_enabled(3),
76       sd_notify(3), systemd.service(5)
77
78
79
80systemd 241                                           SD_EVENT_SET_WATCHDOG(3)
Impressum