mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
Merge pull request #22037 from fbuihuu/watchdog-minor-improvements
Watchdog minor improvements
This commit is contained in:
commit
174eab0066
@ -314,7 +314,8 @@ static int property_set_watchdog(Manager *m, WatchdogType type, sd_bus_message *
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return manager_override_watchdog(m, type, timeout);
|
||||
manager_override_watchdog(m, type, timeout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int property_set_runtime_watchdog(
|
||||
|
@ -3239,15 +3239,15 @@ void manager_set_watchdog(Manager *m, WatchdogType t, usec_t timeout) {
|
||||
m->watchdog[t] = timeout;
|
||||
}
|
||||
|
||||
int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) {
|
||||
void manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (MANAGER_IS_USER(m))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (m->watchdog_overridden[t] == timeout)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (t == WATCHDOG_RUNTIME) {
|
||||
usec_t usec = timestamp_is_set(timeout) ? timeout : m->watchdog[t];
|
||||
@ -3256,7 +3256,6 @@ int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout) {
|
||||
}
|
||||
|
||||
m->watchdog_overridden[t] = timeout;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int manager_reload(Manager *m) {
|
||||
|
@ -573,7 +573,7 @@ ManagerTimestamp manager_timestamp_initrd_mangle(ManagerTimestamp s);
|
||||
|
||||
usec_t manager_get_watchdog(Manager *m, WatchdogType t);
|
||||
void manager_set_watchdog(Manager *m, WatchdogType t, usec_t timeout);
|
||||
int manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout);
|
||||
void manager_override_watchdog(Manager *m, WatchdogType t, usec_t timeout);
|
||||
|
||||
const char* oom_policy_to_string(OOMPolicy i) _const_;
|
||||
OOMPolicy oom_policy_from_string(const char *s) _pure_;
|
||||
|
@ -156,9 +156,6 @@ int watchdog_set_device(const char *path) {
|
||||
int r;
|
||||
|
||||
r = free_and_strdup(&watchdog_device, path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (r > 0) /* watchdog_device changed */
|
||||
watchdog_fd = safe_close(watchdog_fd);
|
||||
|
||||
@ -169,11 +166,9 @@ int watchdog_setup(usec_t timeout) {
|
||||
usec_t previous_timeout;
|
||||
int r;
|
||||
|
||||
/* timeout=0 closes the device whereas passing timeout=USEC_INFINITY
|
||||
* opens it (if needed) without configuring any particular timeout and
|
||||
* thus reuses the programmed value (therefore it's a nop if the device
|
||||
* is already opened).
|
||||
*/
|
||||
/* timeout=0 closes the device whereas passing timeout=USEC_INFINITY opens it (if needed)
|
||||
* without configuring any particular timeout and thus reuses the programmed value (therefore
|
||||
* it's a nop if the device is already opened). */
|
||||
|
||||
if (timeout == 0) {
|
||||
watchdog_close(true);
|
||||
@ -184,9 +179,8 @@ int watchdog_setup(usec_t timeout) {
|
||||
if (watchdog_fd >= 0 && (timeout == watchdog_timeout || timeout == USEC_INFINITY))
|
||||
return 0;
|
||||
|
||||
/* Initialize the watchdog timeout with the caller value. This value is
|
||||
* going to be updated by update_timeout() with the closest value
|
||||
* supported by the driver */
|
||||
/* Initialize the watchdog timeout with the caller value. This value is going to be updated by
|
||||
* update_timeout() with the closest value supported by the driver */
|
||||
previous_timeout = watchdog_timeout;
|
||||
watchdog_timeout = timeout;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user