aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/watchdogd
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2010-09-26 01:45:33 +0000
committerEd Maste <emaste@FreeBSD.org>2010-09-26 01:45:33 +0000
commitf145c771fb7b377425ee1185395c3c65ec529063 (patch)
tree8fcb63d83cbeb4bc52b859255d723176947b12d5 /usr.sbin/watchdogd
parent315490e03152aa5f26c59c117d1f4ecc437de1ae (diff)
downloadsrc-f145c771fb7b377425ee1185395c3c65ec529063.tar.gz
src-f145c771fb7b377425ee1185395c3c65ec529063.zip
Protect the watchdog daemon against swap OOM killer. This is similar to
SVN r199804 which added protection to sshd, cron, syslogd, and inetd.
Notes
Notes: svn path=/head/; revision=213181
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 4b58caf3889e..7bae4ffc3ee4 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();