- fix wait time resolution in alarm and state queue handlers (bz 247711).

This commit is contained in:
Ian Kent 2007-07-18 09:29:49 +00:00
parent 28f861124d
commit a0eb49c1a0
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,56 @@
diff --git a/daemon/state.c b/daemon/state.c
index 6c373c8..39f4497 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -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) {
diff --git a/lib/alarm.c b/lib/alarm.c
index c6c4ba3..90bf7aa 100755
--- a/lib/alarm.c
+++ b/lib/alarm.c
@@ -192,12 +192,14 @@ static void *alarm_handler(void *arg)
now = time(NULL);
if (first->time > now) {
+ struct timeval usecs;
/*
* Wait for alarm to trigger or a new alarm
* to be added.
*/
+ gettimeofday(&usecs, NULL);
expire.tv_sec = first->time;
- expire.tv_nsec = 0;
+ expire.tv_nsec = usecs.tv_usec * 1000;
status = pthread_cond_timedwait(&cond, &mutex, &expire);
if (status && status != ETIMEDOUT)

View File

@ -4,7 +4,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.2
Release: 5
Release: 6
Epoch: 1
License: GPL
Group: System Environment/Daemons
@ -16,6 +16,7 @@ Patch2: autofs-5.0.2-add-missing-multi-support.patch
Patch3: autofs-5.0.2-add-multi-nsswitch-lookup.patch
Patch4: autofs-5.0.2-fix-offset-dir-create.patch
Patch5: autofs-5.0.2-quote-exports.patch
Patch6: autofs-5.0.2-hi-res-time.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel
Conflicts: kernel < 2.6.17
@ -63,6 +64,7 @@ echo %{version}-%{release} > .version
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -115,6 +117,9 @@ fi
%{_libdir}/autofs/
%changelog
* Wed Jul 18 2007 Ian Kent <ikent@redhat.com> - 5.0.2-6
- fix wait time resolution in alarm and state queue handlers (bz 247711).
* Mon Jul 16 2007 Ian Kent <ikent@redhat.com> - 5.0.2-5
- fix mount point directory creation for bind mounts.
- add quoting for exports gathered by hosts map.