Browse Source

This diff makes ntpd poll for sensors more aggressively when the use of

sensors is requested, but no sensors are found.
ok henning
OPENBSD_4_2
ckuethe 17 years ago
parent
commit
5b4a0b0b28
3 changed files with 16 additions and 8 deletions
  1. +5
    -2
      src/usr.sbin/ntpd/ntp.c
  2. +2
    -2
      src/usr.sbin/ntpd/ntpd.h
  3. +9
    -4
      src/usr.sbin/ntpd/sensors.c

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

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


+ 2
- 2
src/usr.sbin/ntpd/ntpd.h View File

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

+ 9
- 4
src/usr.sbin/ntpd/sensors.c View File

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


Loading…
Cancel
Save