vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| * Henning Brauer <henning@openbsd.org> [2005-06-19 19:18]: > * Theo de Raadt <deraadt@cvs.openbsd.org> [2005-06-19 19:00]: > > -s is the choice people can make > > > > without a net, if you start ntpd, it stalls for 45 seconds > > 15 is the timeout the parent process enforces. since dns lookups and > such run in the client process it cannot really interfere. > I don't see how it can ever be more, nor did I ever see more. > well, actually I just see onbe possibility how it could take slightly > longer, but nowhere near 45 seconds. diff below for that case > not using -s, i. e. not (at least trying to) set the clock hard at > system startup, is very bad since it can leave your clock so far off > that adjtime() can't cope (or it takes weeks) and so your clock stays > off. and this is why the last change to rc (not doing -s by default any more) is bad and should be reversed. > the timeout can be shortened, and i ask people to try this diff please: better this instead: Index: ntpd.c ================================================== ================= RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v retrieving revision 1.38 diff -u -p -r1.38 ntpd.c --- ntpd.c 19 Jun 2005 17:11:13 -0000 1.38 +++ ntpd.c 19 Jun 2005 17:53:18 -0000 @@ -81,7 +81,7 @@ main(int argc, char *argv[]) struct pollfd pfd[POLL_MAX]; pid_t chld_pid = 0, pid; const char *conffile; - int ch, nfds, timeout = INFTIM; + int ch, nfds, settime_deadline, timeout = INFTIM; int pipe_chld[2]; conffile = CONFFILE; @@ -152,6 +152,8 @@ main(int argc, char *argv[]) fatal(NULL); imsg_init(ibuf, pipe_chld[0]); + settime_deadline = time(NULL) + SETTIME_TIMEOUT; + while (quit == 0) { pfd[PFD_PIPE].fd = ibuf->fd; pfd[PFD_PIPE].events = POLLIN; @@ -164,7 +166,8 @@ main(int argc, char *argv[]) quit = 1; } - if (nfds == 0 && conf.settime) { + if (conf.settime && + (timeout = (settime_deadline - time(NULL)) * 1000) <= 0) { conf.settime = 0; timeout = INFTIM; log_init(conf.debug); Index: ntpd.h ================================================== ================= RCS file: /cvs/src/usr.sbin/ntpd/ntpd.h,v retrieving revision 1.57 diff -u -p -r1.57 ntpd.h --- ntpd.h 19 Jun 2005 17:11:13 -0000 1.57 +++ ntpd.h 19 Jun 2005 17:53:18 -0000 @@ -55,7 +55,7 @@ #define QUERYTIME_MAX 15 /* single query might take n secs max */ #define OFFSET_ARRAY_SIZE 8 #define SETTIME_MIN_OFFSET 180 /* min offset for settime at start */ -#define SETTIME_TIMEOUT 15 /* max seconds to wait with -s */ +#define SETTIME_TIMEOUT 2 /* max seconds to wait with -s */ #define LOG_NEGLIGEE 128 /* negligible drift to not log (ms) */ enum client_state { -- BS Web Services, http://www.bsws.de/ OpenBSD-based Webhosting, Mail Services, Managed Servers, ... Unix is very simple, but it takes a genius to understand the simplicity. (Dennis Ritchie) |