--- autofs-5.0.1/daemon/state.c.hi-res-time 2007-07-17 22:29:23.000000000 +0800
+++ autofs-5.0.1/daemon/state.c 2007-07-17 22:29:59.000000000 +0800
@@ -894,6 +894,7 @@ static void *st_queue_handler(void *arg)
struct list_head *head;
struct list_head *p;
struct timespec wait;
+ struct timeval now;
int status, ret;
st_mutex_lock();
@@ -904,8 +905,9 @@ static void *st_queue_handler(void *arg)
* entry is added.
*/
head = &state_queue;
- wait.tv_sec = time(NULL) + 1;
- wait.tv_nsec = 0;
+ gettimeofday(&now, NULL);
+ wait.tv_sec = now.tv_sec + 1;
+ wait.tv_nsec = now.tv_usec * 1000;
while (list_empty(head)) {
status = pthread_cond_timedwait(&cond, &mutex, &wait);
@@ -939,8 +941,9 @@ static void *st_queue_handler(void *arg)
}
while (1) {
- wait.tv_sec = time(NULL) + 1;
- wait.tv_nsec = 0;
+ gettimeofday(&now, NULL);
+ wait.tv_sec = now.tv_sec + 1;
+ wait.tv_nsec = now.tv_usec * 1000;
signaled = 0;
while (!signaled) {
--- autofs-5.0.1/lib/alarm.c.hi-res-time 2007-07-17 22:29:23.000000000 +0800
+++ autofs-5.0.1/lib/alarm.c 2007-07-17 22:32:06.000000000 +0800
@@ -178,6 +178,7 @@ static void *alarm_handler(void *arg)
while (1) {
struct alarm *current;
+ struct timeval usecs;
/*
* If the alarm list is empty, wait until an alarm is
@@ -215,8 +216,9 @@ static void *alarm_handler(void *arg)
continue;
}
+ gettimeofday(&usecs, NULL);
expire.tv_sec = current->time;
- expire.tv_nsec = 0;
+ expire.tv_nsec = usecs.tv_usec * 1000;
while (1) {
struct autofs_point *ap;