diff options
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 7 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/ntpd/sensors.c | 13 |
3 files changed, 16 insertions, 8 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 41d8f788b32..26bd5669fe3 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.98 2007/01/15 08:19:11 otto Exp $ */ +/* $OpenBSD: ntp.c,v 1.99 2007/08/04 02:58:02 ckuethe Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -253,9 +253,12 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf) if (last_sensor_scan == 0 || last_sensor_scan + SENSOR_SCAN_INTERVAL < getmonotime()) { - sensor_scan(); + sensors_cnt = sensor_scan(); last_sensor_scan = getmonotime(); } + if (!TAILQ_EMPTY(&conf->ntp_conf_sensors) && sensors_cnt == 0 && + nextaction > last_sensor_scan + SENSOR_SCAN_INTERVAL) + nextaction = last_sensor_scan + SENSOR_SCAN_INTERVAL; sensors_cnt = 0; TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { if (conf->settime && s->offsets[0].offset) diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 6f016cdc0a8..daf17772670 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.84 2007/04/30 01:33:33 deraadt Exp $ */ +/* $OpenBSD: ntpd.h,v 1.85 2007/08/04 02:58:02 ckuethe Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -308,7 +308,7 @@ struct s_fixedpt d_to_sfp(double); /* sensors.c */ void sensor_init(void); -void sensor_scan(void); +int sensor_scan(void); void sensor_query(struct ntp_sensor *); int sensor_hotplugfd(void); void sensor_hotplugevent(int); diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c index 3df6cbdb494..dde110f8f72 100644 --- a/usr.sbin/ntpd/sensors.c +++ b/usr.sbin/ntpd/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.32 2007/01/23 17:44:38 claudio Exp $ */ +/* $OpenBSD: sensors.c,v 1.33 2007/08/04 02:58:02 ckuethe Exp $ */ /* * Copyright (c) 2006 Henning Brauer <henning@openbsd.org> @@ -45,16 +45,21 @@ sensor_init(void) TAILQ_INIT(&conf->ntp_sensors); } -void +int sensor_scan(void) { - int i; + int i, n; char d[MAXDEVNAMLEN]; struct sensor s; + n = 0; for (i = 0; i < MAXSENSORDEVICES; i++) - if (sensor_probe(i, d, &s)) + if (sensor_probe(i, d, &s)) { sensor_add(i, d); + n++; + } + + return n; } int |