chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemd: add hardware watchdog support
[elogind.git]
/
src
/
shutdown.c
diff --git
a/src/shutdown.c
b/src/shutdown.c
index d157e0fbfeaf4db91cea33666f9e2ab5c59c3633..9f65b1dab0b78aeed203717b75ba3852cc3ceb1e 100644
(file)
--- a/
src/shutdown.c
+++ b/
src/shutdown.c
@@
-42,6
+42,7
@@
#include "umount.h"
#include "util.h"
#include "virt.h"
#include "umount.h"
#include "util.h"
#include "virt.h"
+#include "watchdog.h"
#define TIMEOUT_USEC (5 * USEC_PER_SEC)
#define FINALIZE_ATTEMPTS 50
#define TIMEOUT_USEC (5 * USEC_PER_SEC)
#define FINALIZE_ATTEMPTS 50
@@
-306,7
+307,7
@@
int main(int argc, char *argv[]) {
int cmd, r;
unsigned retries;
bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true;
int cmd, r;
unsigned retries;
bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true;
- bool killed_everbody = false, in_container;
+ bool killed_everbody = false, in_container
, use_watchdog = false
;
log_parse_environment();
log_set_target(LOG_TARGET_CONSOLE); /* syslog will die if not gone yet */
log_parse_environment();
log_set_target(LOG_TARGET_CONSOLE); /* syslog will die if not gone yet */
@@
-342,6
+343,8
@@
int main(int argc, char *argv[]) {
goto error;
}
goto error;
}
+ use_watchdog = !!getenv("WATCHDOG_USEC");
+
/* lock us into memory */
if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0)
log_warning("Cannot lock process memory: %m");
/* lock us into memory */
if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0)
log_warning("Cannot lock process memory: %m");
@@
-359,6
+362,9
@@
int main(int argc, char *argv[]) {
for (retries = 0; retries < FINALIZE_ATTEMPTS; retries++) {
bool changed = false;
for (retries = 0; retries < FINALIZE_ATTEMPTS; retries++) {
bool changed = false;
+ if (use_watchdog)
+ watchdog_ping();
+
if (need_umount) {
log_info("Unmounting file systems.");
r = umount_all(&changed);
if (need_umount) {
log_info("Unmounting file systems.");
r = umount_all(&changed);