1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-07 01:58:02 +03:00

Merge pull request #24688 from yuwata/watchdog-dbus-properties-follow-ups

pid1: follow-ups for watchdog DBus properties
This commit is contained in:
Yu Watanabe 2022-09-17 00:18:05 +09:00 committed by GitHub
commit e99b370ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 54 deletions

View File

@ -393,6 +393,12 @@ node /org/freedesktop/systemd1 {
readonly s DefaultStandardOutput = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s DefaultStandardError = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s WatchdogDevice = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
readonly t WatchdogLastPingTimestamp = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
readonly t WatchdogLastPingTimestampMonotonic = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
@org.freedesktop.systemd1.Privileged("true")
readwrite t RuntimeWatchdogUSec = ...;
@ -515,16 +521,6 @@ node /org/freedesktop/systemd1 {
readonly i DefaultOOMScoreAdjust = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s CtrlAltDelBurstAction = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s WatchdogDevice = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t WatchdogTimeoutUsec = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t WatchdogPreTimeoutUsec = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t WatchdogLastPingTimestamp = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly t WatchdogLastPingTimestampMonotonic = ...;
};
interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... };
@ -662,6 +658,12 @@ node /org/freedesktop/systemd1 {
<!--property DefaultStandardError is not documented!-->
<!--property WatchdogDevice is not documented!-->
<!--property WatchdogLastPingTimestamp is not documented!-->
<!--property WatchdogLastPingTimestampMonotonic is not documented!-->
<!--property RuntimeWatchdogUSec is not documented!-->
<!--property RuntimeWatchdogPreUSec is not documented!-->
@ -776,16 +778,6 @@ node /org/freedesktop/systemd1 {
<!--property CtrlAltDelBurstAction is not documented!-->
<!--property WatchdogDevice is not documented!-->
<!--property WatchdogTimeoutUsec is not documented!-->
<!--property WatchdogPreTimeoutUsec is not documented!-->
<!--property WatchdogLastPingTimestamp is not documented!-->
<!--property WatchdogLastPingTimestampMonotonic is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.systemd1.Manager"/>
@ -1080,6 +1072,12 @@ node /org/freedesktop/systemd1 {
<variablelist class="dbus-property" generated="True" extra-ref="DefaultStandardError"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogDevice"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogLastPingTimestamp"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogLastPingTimestampMonotonic"/>
<variablelist class="dbus-property" generated="True" extra-ref="RuntimeWatchdogUSec"/>
<variablelist class="dbus-property" generated="True" extra-ref="RuntimeWatchdogPreUSec"/>
@ -1196,16 +1194,6 @@ node /org/freedesktop/systemd1 {
<variablelist class="dbus-property" generated="True" extra-ref="CtrlAltDelBurstAction"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogDevice"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogTimeoutUsec"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogPreTimeoutUsec"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogLastPingTimestamp"/>
<variablelist class="dbus-property" generated="True" extra-ref="WatchdogLastPingTimestampMonotonic"/>
<!--End of Autogenerated section-->
<refsect2>

View File

@ -62,8 +62,6 @@ static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "u", Hashmap *, ha
static BUS_DEFINE_PROPERTY_GET_REF(property_get_set_size, "u", Set *, set_size);
static BUS_DEFINE_PROPERTY_GET(property_get_default_timeout_abort_usec, "t", Manager, manager_default_timeout_abort_usec);
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_watchdog_device, "s", watchdog_get_device());
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_watchdog_timeout, "t", watchdog_get_timeout());
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_watchdog_pretimeout, "t", watchdog_get_pretimeout());
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_watchdog_last_ping_realtime, "t", watchdog_get_last_ping(CLOCK_REALTIME));
static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_watchdog_last_ping_monotonic, "t", watchdog_get_last_ping(CLOCK_MONOTONIC));
@ -2725,6 +2723,9 @@ const sd_bus_vtable bus_manager_vtable[] = {
SD_BUS_PROPERTY("UnitPath", "as", NULL, offsetof(Manager, lookup_paths.search_path), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("DefaultStandardOutput", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_output, offsetof(Manager, default_std_error), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogDevice", "s", property_get_watchdog_device, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogLastPingTimestamp", "t", property_get_watchdog_last_ping_realtime, 0, 0),
SD_BUS_PROPERTY("WatchdogLastPingTimestampMonotonic", "t", property_get_watchdog_last_ping_monotonic, 0, 0),
SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", property_get_runtime_watchdog, property_set_runtime_watchdog, 0, 0),
SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogPreUSec", "t", property_get_pretimeout_watchdog, property_set_pretimeout_watchdog, 0, 0),
SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogPreGovernor", "s", property_get_pretimeout_watchdog_governor, property_set_pretimeout_watchdog_governor, 0, 0),
@ -2788,11 +2789,6 @@ const sd_bus_vtable bus_manager_vtable[] = {
SD_BUS_PROPERTY("DefaultOOMPolicy", "s", bus_property_get_oom_policy, offsetof(Manager, default_oom_policy), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("DefaultOOMScoreAdjust", "i", property_get_oom_score_adjust, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("CtrlAltDelBurstAction", "s", bus_property_get_emergency_action, offsetof(Manager, cad_burst_action), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogDevice", "s", property_get_watchdog_device, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogTimeoutUsec", "t", property_get_watchdog_timeout, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogPreTimeoutUsec", "t", property_get_watchdog_pretimeout, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogLastPingTimestamp", "t", property_get_watchdog_last_ping_realtime, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("WatchdogLastPingTimestampMonotonic", "t", property_get_watchdog_last_ping_monotonic, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_METHOD_WITH_ARGS("GetUnit",
SD_BUS_ARGS("s", name),

View File

@ -18,9 +18,9 @@
#include "watchdog.h"
static int watchdog_fd = -1;
static char *watchdog_device;
static usec_t watchdog_timeout; /* 0 → close device and USEC_INFINITY → don't change timeout */
static usec_t watchdog_pretimeout; /* 0 → disable pretimeout and USEC_INFINITY → don't change pretimeout */
static char *watchdog_device = NULL;
static usec_t watchdog_timeout = 0; /* 0 → close device and USEC_INFINITY → don't change timeout */
static usec_t watchdog_pretimeout = 0; /* 0 → disable pretimeout and USEC_INFINITY → don't change pretimeout */
static usec_t watchdog_last_ping = USEC_INFINITY;
static bool watchdog_supports_pretimeout = false; /* Depends on kernel state that might change at runtime */
static char *watchdog_pretimeout_governor = NULL;
@ -119,12 +119,6 @@ static int watchdog_set_enable(bool enable) {
return 0;
}
usec_t watchdog_get_timeout(void) {
if (watchdog_timeout == USEC_INFINITY)
return 0;
return watchdog_timeout;
}
static int watchdog_read_timeout(void) {
int sec = 0;
@ -156,12 +150,6 @@ static int watchdog_set_timeout(void) {
return 0;
}
usec_t watchdog_get_pretimeout(void) {
if (watchdog_pretimeout == USEC_INFINITY)
return 0;
return watchdog_pretimeout;
}
static int watchdog_read_pretimeout(void) {
int sec = 0;

View File

@ -7,8 +7,6 @@
#include "util.h"
const char *watchdog_get_device(void);
usec_t watchdog_get_timeout(void);
usec_t watchdog_get_pretimeout(void);
usec_t watchdog_get_last_ping(clockid_t clock);
int watchdog_set_device(const char *path);