Date: Sun, 26 Sep 2010 13:48:19 +0300 From: Mikolaj Golub <to.my.trociny@gmail.com> To: Ed Maste <emaste@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213181 - head/usr.sbin/watchdogd Message-ID: <86mxr4eq6k.fsf@kopusha.home.net> In-Reply-To: <201009260145.o8Q1jXUk078511@svn.freebsd.org> (Ed Maste's message of "Sun, 26 Sep 2010 01:45:33 %2B0000 (UTC)") References: <201009260145.o8Q1jXUk078511@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
EM> Log:
EM> Protect the watchdog daemon against swap OOM killer. This is similar to
EM> SVN r199804 which added protection to sshd, cron, syslogd, and inetd.
May be there is a sense to have some utility in the system so that an admin
could protect any process he wanted? E.g. something like in the attach.
--
Mikolaj Golub
[-- Attachment #2 --]
#include <sys/mman.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void usage(void);
int
main(int argc, char *argv[])
{
argc--;
argv++;
if (argc == 0)
usage();
if (madvise(0, 0, MADV_PROTECT) != 0)
warn("madvise failed");
errno = 0;
execvp(*argv, argv);
err(errno == ENOENT ? 127 : 126, "%s", *argv);
}
void
usage(void)
{
(void)fprintf(stderr,
"usage: mprotect utility [argument ...]\n");
exit(1);
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86mxr4eq6k.fsf>
