diff options
author | attilio <attilio@FreeBSD.org> | 2009-11-25 15:12:24 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2009-11-25 15:12:24 +0000 |
commit | 99524169bf3f72fffa8e41ace1a952854e3f97d3 (patch) | |
tree | f308da7e1d86252ddb2bfef1aafa5f589034f693 /usr.sbin/syslogd | |
parent | c984dc56360945b3348330530b2cec41b26e99e5 (diff) | |
download | FreeBSD-src-99524169bf3f72fffa8e41ace1a952854e3f97d3.zip FreeBSD-src-99524169bf3f72fffa8e41ace1a952854e3f97d3.tar.gz |
Avoid sshd, cron, syslogd and inetd to be killed under high-pressure swap
environments.
Please note that this can't be done while such processes run in jails.
Note: in future it would be interesting to find a way to do that
selectively for any desired proccess (choosen by user himself), probabilly
via a ptrace interface or whatever.
Obtained from: Sandvine Incorporated
Reviewed by: emaste, arch@
Sponsored by: Sandvine Incorporated
MFC: 1 month
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 3e628a2..5cb0af9 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/ioctl.h> +#include <sys/mman.h> #include <sys/stat.h> #include <sys/wait.h> #include <sys/socket.h> @@ -352,6 +353,9 @@ main(int argc, char *argv[]) pid_t ppid = 1, spid; socklen_t len; + if (madvise(NULL, 0, MADV_PROTECT) != 0) + dprintf("madvise() failed: %s\n", strerror(errno)); + bindhostname = NULL; while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nop:P:sS:Tuv")) != -1) |