Index: head/crypto/openssh/sshd.c =================================================================== --- head/crypto/openssh/sshd.c (revision 199493) +++ head/crypto/openssh/sshd.c (working copy) @@ -47,6 +47,7 @@ #include #include +#include #include #ifdef HAVE_SYS_STAT_H # include @@ -1293,6 +1294,10 @@ /* Initialize configuration options to their default values. */ initialize_server_options(&options); + /* Avoid killing the process in high-pressure swapping environments. */ + if (madvise(NULL, 0, MADV_PROTECT) != 0) + debug("madvise(): %.200s", strerror(errno)); + /* Parse command-line arguments. */ while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:C:dDeiqrtQRT46")) != -1) { switch (opt) { Index: head/usr.sbin/cron/cron/cron.c =================================================================== --- head/usr.sbin/cron/cron/cron.c (revision 199493) +++ head/usr.sbin/cron/cron/cron.c (working copy) @@ -24,6 +24,7 @@ #include "cron.h" +#include #include #if SYS_TIME_H # include @@ -134,6 +135,9 @@ } } + if (madvise(NULL, 0, MADV_PROTECT) != 0) + log_it("CRON", getpid(), "WARNING", "madvise() failed"); + pidfile_write(pfh); database.head = NULL; database.tail = NULL; Index: head/usr.sbin/syslogd/syslogd.c =================================================================== --- head/usr.sbin/syslogd/syslogd.c (revision 199493) +++ head/usr.sbin/syslogd/syslogd.c (working copy) @@ -77,6 +77,7 @@ #include #include +#include #include #include #include @@ -352,6 +353,9 @@ 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) Index: head/usr.sbin/inetd/inetd.c =================================================================== --- head/usr.sbin/inetd/inetd.c (revision 199493) +++ head/usr.sbin/inetd/inetd.c (working copy) @@ -110,6 +110,7 @@ */ #include #include +#include #include #include #include @@ -497,6 +498,9 @@ } } + if (madvise(NULL, 0, MADV_PROTECT) != 0) + syslog(LOG_WARNING, "madvise() failed: %s", strerror(errno)); + for (i = 0; i < PERIPSIZE; ++i) LIST_INIT(&proctable[i]);