Browse Source

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@
OPENBSD_5_5
dtucker 11 years ago
parent
commit
c438f027ad
2 changed files with 12 additions and 2 deletions
  1. +7
    -1
      src/usr.sbin/ntpd/ntp_dns.c
  2. +5
    -1
      src/usr.sbin/ntpd/ntpd.c

+ 7
- 1
src/usr.sbin/ntpd/ntp_dns.c View File

@ -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);


+ 5
- 1
src/usr.sbin/ntpd/ntpd.c View File

@ -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);


Loading…
Cancel
Save