]> git.pld-linux.org Git - packages/autofs.git/blame - autofs-5.0.2-hi-res-time.patch
- rel.1, lets try
[packages/autofs.git] / autofs-5.0.2-hi-res-time.patch
CommitLineData
3d551623
PG
1diff --git a/CHANGELOG b/CHANGELOG
2index 903e619..bc4d8fd 100644
3--- a/CHANGELOG
4+++ b/CHANGELOG
5@@ -8,6 +8,7 @@
6 with existing downstream version 4 naming.
7 - fix mount point directory creation for bind mounts.
8 - add quoting for exports gathered by hosts map.
9+- fix wait time resolution in alarm and state queue handlers.
10
11 18/06/2007 autofs-5.0.2
12 -----------------------
13diff --git a/daemon/state.c b/daemon/state.c
14index 6c373c8..39f4497 100644
15--- a/daemon/state.c
16+++ b/daemon/state.c
17@@ -894,6 +894,7 @@ static void *st_queue_handler(void *arg)
18 struct list_head *head;
19 struct list_head *p;
20 struct timespec wait;
21+ struct timeval now;
22 int status, ret;
23
24 st_mutex_lock();
25@@ -904,8 +905,9 @@ static void *st_queue_handler(void *arg)
26 * entry is added.
27 */
28 head = &state_queue;
29- wait.tv_sec = time(NULL) + 1;
30- wait.tv_nsec = 0;
31+ gettimeofday(&now, NULL);
32+ wait.tv_sec = now.tv_sec + 1;
33+ wait.tv_nsec = now.tv_usec * 1000;
34
35 while (list_empty(head)) {
36 status = pthread_cond_timedwait(&cond, &mutex, &wait);
37@@ -939,8 +941,9 @@ static void *st_queue_handler(void *arg)
38 }
39
40 while (1) {
41- wait.tv_sec = time(NULL) + 1;
42- wait.tv_nsec = 0;
43+ gettimeofday(&now, NULL);
44+ wait.tv_sec = now.tv_sec + 1;
45+ wait.tv_nsec = now.tv_usec * 1000;
46
47 signaled = 0;
48 while (!signaled) {
49diff --git a/lib/alarm.c b/lib/alarm.c
50index c6c4ba3..90bf7aa 100755
51--- a/lib/alarm.c
52+++ b/lib/alarm.c
53@@ -192,12 +192,14 @@ static void *alarm_handler(void *arg)
54 now = time(NULL);
55
56 if (first->time > now) {
57+ struct timeval usecs;
58 /*
59 * Wait for alarm to trigger or a new alarm
60 * to be added.
61 */
62+ gettimeofday(&usecs, NULL);
63 expire.tv_sec = first->time;
64- expire.tv_nsec = 0;
65+ expire.tv_nsec = usecs.tv_usec * 1000;
66
67 status = pthread_cond_timedwait(&cond, &mutex, &expire);
68 if (status && status != ETIMEDOUT)
This page took 0.293332 seconds and 4 git commands to generate.