diff options
author | 2014-02-10 09:12:34 +0000 | |
---|---|---|
committer | 2014-02-10 09:12:34 +0000 | |
commit | 832033ea366d3d5e4061a399137bdb0ffd2ba0ec (patch) | |
tree | bec267c79c19faddba301bb4d4b82b1ca0437f22 | |
parent | the mac addresses you program with MYXCMD_SET_MCASTGROUP are in a different (diff) | |
download | wireguard-openbsd-832033ea366d3d5e4061a399137bdb0ffd2ba0ec.tar.xz wireguard-openbsd-832033ea366d3d5e4061a399137bdb0ffd2ba0ec.zip |
Run the serving and privileged ntpd processes at high priority and the
dns process at normal priority. Should improve latency on loaded machines.
ok henning@
-rw-r--r-- | usr.sbin/ntpd/ntp_dns.c | 8 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.c | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c index 44148fe2641..931c25ee5da 100644 --- a/usr.sbin/ntpd/ntp_dns.c +++ b/usr.sbin/ntpd/ntp_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp_dns.c,v 1.4 2013/11/13 20:44:39 benno Exp $ */ +/* $OpenBSD: ntp_dns.c,v 1.5 2014/02/10 09:12:34 dtucker Exp $ */ /* * Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org> @@ -17,7 +17,10 @@ */ #include <sys/param.h> +#include <sys/resource.h> #include <sys/time.h> + +#include <err.h> #include <errno.h> #include <poll.h> #include <signal.h> @@ -61,6 +64,9 @@ ntp_dns(int pipe_ntp[2], struct ntpd_conf *nconf, struct passwd *pw) return (pid); } + if (setpriority(PRIO_PROCESS, 0, 0) == -1) + warn("could not set priority"); + /* in this case the parent didn't init logging and didn't daemonize */ if (nconf->settime && !nconf->debug) { log_init(nconf->debug); diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c index 3d1e9a0730c..20b499330c3 100644 --- a/usr.sbin/ntpd/ntpd.c +++ b/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.78 2014/01/28 22:57:37 sthen Exp $ */ +/* $OpenBSD: ntpd.c,v 1.79 2014/02/10 09:12:34 dtucker Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -18,6 +18,7 @@ */ #include <sys/types.h> +#include <sys/resource.h> #include <sys/socket.h> #include <sys/wait.h> #include <sys/un.h> @@ -166,6 +167,9 @@ main(int argc, char *argv[]) if ((pw = getpwnam(NTPD_USER)) == NULL) errx(1, "unknown user %s", NTPD_USER); + if (setpriority(PRIO_PROCESS, 0, -20) == -1) + warn("can't set priority"); + reset_adjtime(); if (!lconf.settime) { log_init(lconf.debug); |