summaryrefslogtreecommitdiffstats
path: root/usr.sbin/watchdogd
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2010-09-26 01:45:33 +0000
committeremaste <emaste@FreeBSD.org>2010-09-26 01:45:33 +0000
commita774d4e29c403d77f8e5419067d8c94733e670d7 (patch)
tree8fcb63d83cbeb4bc52b859255d723176947b12d5 /usr.sbin/watchdogd
parent7afff3e55e9b296722d109b0f12ce2ac9e0c7547 (diff)
downloadFreeBSD-src-a774d4e29c403d77f8e5419067d8c94733e670d7.zip
FreeBSD-src-a774d4e29c403d77f8e5419067d8c94733e670d7.tar.gz
Protect the watchdog daemon against swap OOM killer. This is similar to
SVN r199804 which added protection to sshd, cron, syslogd, and inetd.
Diffstat (limited to 'usr.sbin/watchdogd')
-rw-r--r--usr.sbin/watchdogd/watchdogd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c
index 4b58caf..7bae4ff 100644
--- a/usr.sbin/watchdogd/watchdogd.c
+++ b/usr.sbin/watchdogd/watchdogd.c
@@ -31,6 +31,7 @@
#include <sys/types.h>
__FBSDID("$FreeBSD$");
+#include <sys/mman.h>
#include <sys/param.h>
#include <sys/rtprio.h>
#include <sys/stat.h>
@@ -115,6 +116,8 @@ main(int argc, char *argv[])
signal(SIGTERM, sighandler);
pidfile_write(pfh);
+ if (madvise(0, 0, MADV_PROTECT) != 0)
+ warn("madvise failed");
watchdog_loop();
OpenPOWER on IntegriCloud