summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--linuxthreads/ChangeLog8
-rw-r--r--linuxthreads/condvar.c54
-rw-r--r--sysdeps/alpha/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/alpha/fpu/fesetround.c4
-rw-r--r--sysdeps/arm/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/arm/fpu/fesetround.c2
-rw-r--r--sysdeps/generic/feholdexcpt.c2
-rw-r--r--sysdeps/generic/fesetround.c2
-rw-r--r--sysdeps/i386/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/i386/fpu/fesetround.c4
-rw-r--r--sysdeps/m68k/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/m68k/fpu/fesetround.c4
-rw-r--r--sysdeps/mips/fpu/fesetround.c4
-rw-r--r--sysdeps/powerpc/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/powerpc/fpu/fesetround.c4
-rw-r--r--sysdeps/sparc/fpu/feholdexcpt.c2
-rw-r--r--sysdeps/sparc/fpu/fesetround.c4
18 files changed, 81 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index d478e8ae6f..a019bf08c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2000-01-30 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/alpha/fpu/feholdexcpt.c: Correct return value according to
+ the standard.
+ * sysdeps/alpha/fpu/fesetround.c: Likewise.
+ * sysdeps/arm/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/arm/fpu/fesetround.c: Likewise.
+ * sysdeps/generic/feholdexcpt.c: Likewise.
+ * sysdeps/generic/fesetround.c: Likewise.
+ * sysdeps/i386/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/i386/fpu/fesetround.c: Likewise.
+ * sysdeps/m68k/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/m68k/fpu/fesetround.c: Likewise.
+ * sysdeps/mips/fpu/fesetround.c: Likewise.
+ * sysdeps/powerpc/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/powerpc/fpu/fesetround.c: Likewise.
+ * sysdeps/sparc/fpu/feholdexcpt.c: Likewise.
+ * sysdeps/sparc/fpu/fesetround.c: Likewise.
+ Patch by Miloslav Trmac <mitr@volny.cz>.
+
* locale/programs/ld-collate.c (struct locale_collate_t): Change
type of plane_size and plane_cnt to uint32_t.
Reported by Jakub Jelinek.
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 00678616e1..5faddcffdd 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,11 @@
+2000-01-31 Ulrich Drepper <drepper@redhat.com>
+
+ * condvar.c (pthread_cond_timedwait_relative_old): Recompute time
+ before every nanosleep call to account for time spent in the rest
+ of the function.
+ (pthread_cond_timedwait_relative_new): Likewise.
+ Patch by khendricks@ivey.uwo.ca (PR libc/1564).
+
2000-01-29 Ulrich Drepper <drepper@redhat.com>
* condvar.c (pthread_cond_timedwait_relative_old): Get remaining time
diff --git a/linuxthreads/condvar.c b/linuxthreads/condvar.c
index aab3ff257b..5f0e1939d3 100644
--- a/linuxthreads/condvar.c
+++ b/linuxthreads/condvar.c
@@ -26,13 +26,13 @@
#include "restart.h"
static int pthread_cond_timedwait_relative_old(pthread_cond_t *,
- pthread_mutex_t *, struct timespec *);
+ pthread_mutex_t *, const struct timespec *);
static int pthread_cond_timedwait_relative_new(pthread_cond_t *,
- pthread_mutex_t *, struct timespec *);
+ pthread_mutex_t *, const struct timespec *);
static int (*pthread_cond_tw_rel)(pthread_cond_t *, pthread_mutex_t *,
- struct timespec *) = pthread_cond_timedwait_relative_old;
+ const struct timespec *) = pthread_cond_timedwait_relative_old;
/* initialize this module */
void __pthread_init_condvar(int rt_sig_available)
@@ -130,16 +130,29 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static int
pthread_cond_timedwait_relative_old(pthread_cond_t *cond,
pthread_mutex_t *mutex,
- struct timespec * reltime)
+ const struct timespec * abstime)
{
volatile pthread_descr self = thread_self();
sigset_t unblock, initial_mask;
int retsleep, already_canceled, was_signalled;
sigjmp_buf jmpbuf;
pthread_extricate_if extr;
+ struct timeval now;
+ struct timespec reltime;
requeue_and_wait_again:
+ /* Compute a time offset relative to now. */
+ __gettimeofday (&now, NULL);
+ reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000;
+ reltime.tv_sec = abstime->tv_sec - now.tv_sec;
+ if (reltime.tv_nsec < 0) {
+ reltime.tv_nsec += 1000000000;
+ reltime.tv_sec -= 1;
+ }
+ if (reltime.tv_sec < 0)
+ return ETIMEDOUT;
+
retsleep = 0;
already_canceled = 0;
was_signalled = 0;
@@ -179,7 +192,7 @@ requeue_and_wait_again:
sigaddset(&unblock, __pthread_sig_restart);
sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask);
/* Sleep for the required duration */
- retsleep = __libc_nanosleep(reltime, reltime);
+ retsleep = __libc_nanosleep(&reltime, NULL);
/* Block the restart signal again */
sigprocmask(SIG_SETMASK, &initial_mask, NULL);
was_signalled = 0;
@@ -250,16 +263,29 @@ requeue_and_wait_again:
static int
pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
pthread_mutex_t *mutex,
- struct timespec * reltime)
+ const struct timespec * abstime)
{
volatile pthread_descr self = thread_self();
sigset_t unblock, initial_mask;
int retsleep, already_canceled, was_signalled;
sigjmp_buf jmpbuf;
pthread_extricate_if extr;
+ struct timeval now;
+ struct timespec reltime;
requeue_and_wait_again:
+ /* Compute a time offset relative to now. */
+ __gettimeofday (&now, NULL);
+ reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000;
+ reltime.tv_sec = abstime->tv_sec - now.tv_sec;
+ if (reltime.tv_nsec < 0) {
+ reltime.tv_nsec += 1000000000;
+ reltime.tv_sec -= 1;
+ }
+ if (reltime.tv_sec < 0)
+ return ETIMEDOUT;
+
retsleep = 0;
already_canceled = 0;
was_signalled = 0;
@@ -298,7 +324,7 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
sigaddset(&unblock, __pthread_sig_restart);
sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask);
/* Sleep for the required duration */
- retsleep = __libc_nanosleep(reltime, reltime);
+ retsleep = __libc_nanosleep(&reltime, NULL);
/* Block the restart signal again */
sigprocmask(SIG_SETMASK, &initial_mask, NULL);
was_signalled = 0;
@@ -363,20 +389,8 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec * abstime)
{
- struct timeval now;
- struct timespec reltime;
- /* Compute a time offset relative to now */
- __gettimeofday(&now, NULL);
- reltime.tv_sec = abstime->tv_sec - now.tv_sec;
- reltime.tv_nsec = abstime->tv_nsec - now.tv_usec * 1000;
- if (reltime.tv_nsec < 0) {
- reltime.tv_nsec += 1000000000;
- reltime.tv_sec -= 1;
- }
- if (reltime.tv_sec < 0) return ETIMEDOUT;
-
/* Indirect call through pointer! */
- return pthread_cond_tw_rel(cond, mutex, &reltime);
+ return pthread_cond_tw_rel(cond, mutex, abstime);
}
int pthread_cond_signal(pthread_cond_t *cond)
diff --git a/sysdeps/alpha/fpu/feholdexcpt.c b/sysdeps/alpha/fpu/feholdexcpt.c
index 493d6a18eb..a179366cbf 100644
--- a/sysdeps/alpha/fpu/feholdexcpt.c
+++ b/sysdeps/alpha/fpu/feholdexcpt.c
@@ -29,5 +29,5 @@ feholdexcept (fenv_t *envp)
/* Clear all exception status bits and exception enable bits. */
__ieee_set_fp_control(0);
- return 1;
+ return 0;
}
diff --git a/sysdeps/alpha/fpu/fesetround.c b/sysdeps/alpha/fpu/fesetround.c
index f49586cf8b..f0aaaa2c88 100644
--- a/sysdeps/alpha/fpu/fesetround.c
+++ b/sysdeps/alpha/fpu/fesetround.c
@@ -26,7 +26,7 @@ fesetround (int round)
unsigned long fpcr;
if (round & ~3)
- return 0;
+ return 1;
/* Get the current state. */
__asm__ __volatile__("excb; mf_fpcr %0" : "=f"(fpcr));
@@ -37,5 +37,5 @@ fesetround (int round)
/* Put the new state in effect. */
__asm__ __volatile__("mt_fpcr %0; excb" : : "f"(fpcr));
- return 1;
+ return 0;
}
diff --git a/sysdeps/arm/fpu/feholdexcpt.c b/sysdeps/arm/fpu/feholdexcpt.c
index 3faabd90eb..3422d54bb8 100644
--- a/sysdeps/arm/fpu/feholdexcpt.c
+++ b/sysdeps/arm/fpu/feholdexcpt.c
@@ -33,5 +33,5 @@ feholdexcept (fenv_t *envp)
temp &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
_FPU_SETCW(temp);
- return 1;
+ return 0;
}
diff --git a/sysdeps/arm/fpu/fesetround.c b/sysdeps/arm/fpu/fesetround.c
index 7591b397e1..04eb09c413 100644
--- a/sysdeps/arm/fpu/fesetround.c
+++ b/sysdeps/arm/fpu/fesetround.c
@@ -23,5 +23,5 @@ int
fesetround (int round)
{
/* We only support FE_TONEAREST, so there is no need for any work. */
- return (round == FE_TONEAREST)?1:0;
+ return (round == FE_TONEAREST)?0:1;
}
diff --git a/sysdeps/generic/feholdexcpt.c b/sysdeps/generic/feholdexcpt.c
index 5cc9b38a28..89141ea711 100644
--- a/sysdeps/generic/feholdexcpt.c
+++ b/sysdeps/generic/feholdexcpt.c
@@ -23,7 +23,7 @@
int
feholdexcept (fenv_t *envp)
{
- return 0; /* Signal failure. */
+ return 1; /* Signal failure. */
}
stub_warning (feholdexcept)
#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetround.c b/sysdeps/generic/fesetround.c
index cd77a76fcf..b64e8463b1 100644
--- a/sysdeps/generic/fesetround.c
+++ b/sysdeps/generic/fesetround.c
@@ -23,7 +23,7 @@
int
fesetround (int round)
{
- return 0; /* Signal we are unable to set the direction. */
+ return 1; /* Signal we are unable to set the direction. */
}
stub_warning (fesetround)
#include <stub-tag.h>
diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c
index f056abb27c..022625d787 100644
--- a/sysdeps/i386/fpu/feholdexcpt.c
+++ b/sysdeps/i386/fpu/feholdexcpt.c
@@ -32,5 +32,5 @@ feholdexcept (fenv_t *envp)
work = envp->__control_word | 0x3f;
__asm__ ("fldcw %0" : : "m" (*&work));
- return 1;
+ return 0;
}
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c
index 844c58663e..9b5b0890de 100644
--- a/sysdeps/i386/fpu/fesetround.c
+++ b/sysdeps/i386/fpu/fesetround.c
@@ -27,12 +27,12 @@ fesetround (int round)
if ((round & ~0xc00) != 0)
/* ROUND is no valid rounding mode. */
- return 0;
+ return 1;
__asm__ ("fnstcw %0" : "=m" (*&cw));
cw &= ~0xc00;
cw |= round;
__asm__ ("fldcw %0" : : "m" (*&cw));
- return 1;
+ return 0;
}
diff --git a/sysdeps/m68k/fpu/feholdexcpt.c b/sysdeps/m68k/fpu/feholdexcpt.c
index 1ccf84bc86..44a7c7d9fd 100644
--- a/sysdeps/m68k/fpu/feholdexcpt.c
+++ b/sysdeps/m68k/fpu/feholdexcpt.c
@@ -35,5 +35,5 @@ feholdexcept (fenv_t *envp)
fpcr = envp->__control_register & ~(FE_ALL_EXCEPT << 6);
__asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (fpcr));
- return 1;
+ return 0;
}
diff --git a/sysdeps/m68k/fpu/fesetround.c b/sysdeps/m68k/fpu/fesetround.c
index 8d5466c956..8e06a15f03 100644
--- a/sysdeps/m68k/fpu/fesetround.c
+++ b/sysdeps/m68k/fpu/fesetround.c
@@ -27,12 +27,12 @@ fesetround (int round)
if (round & ~FE_UPWARD)
/* ROUND is no valid rounding mode. */
- return 0;
+ return 1;
__asm__ ("fmove%.l %!,%0" : "=dm" (fpcr));
fpcr &= ~FE_UPWARD;
fpcr |= round;
__asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (fpcr));
- return 1;
+ return 0;
}
diff --git a/sysdeps/mips/fpu/fesetround.c b/sysdeps/mips/fpu/fesetround.c
index 6b623d6eab..ae6ae86bb1 100644
--- a/sysdeps/mips/fpu/fesetround.c
+++ b/sysdeps/mips/fpu/fesetround.c
@@ -28,7 +28,7 @@ fesetround (int round)
if ((round & ~0x3) != 0)
/* ROUND is no valid rounding mode. */
- return 0;
+ return 1;
/* Get current state. */
_FPU_GETCW (cw);
@@ -39,5 +39,5 @@ fesetround (int round)
/* Set new state. */
_FPU_SETCW (cw);
- return 1;
+ return 0;
}
diff --git a/sysdeps/powerpc/fpu/feholdexcpt.c b/sysdeps/powerpc/fpu/feholdexcpt.c
index a75adbf49e..c19d223aa7 100644
--- a/sysdeps/powerpc/fpu/feholdexcpt.c
+++ b/sysdeps/powerpc/fpu/feholdexcpt.c
@@ -34,5 +34,5 @@ feholdexcept (fenv_t *envp)
/* Put the new state in effect. */
fesetenv_register (u.fenv);
- return 1;
+ return 0;
}
diff --git a/sysdeps/powerpc/fpu/fesetround.c b/sysdeps/powerpc/fpu/fesetround.c
index 875c89768a..016f8e008d 100644
--- a/sysdeps/powerpc/fpu/fesetround.c
+++ b/sysdeps/powerpc/fpu/fesetround.c
@@ -26,7 +26,7 @@ fesetround (int round)
fenv_union_t u;
if ((unsigned int) round > 3)
- return 0;
+ return 1;
/* Get the current state. */
u.fenv = fegetenv_register ();
@@ -37,5 +37,5 @@ fesetround (int round)
/* Put the new state in effect. */
fesetenv_register (u.fenv);
- return 1;
+ return 0;
}
diff --git a/sysdeps/sparc/fpu/feholdexcpt.c b/sysdeps/sparc/fpu/feholdexcpt.c
index b86671ca28..86e7f90df6 100644
--- a/sysdeps/sparc/fpu/feholdexcpt.c
+++ b/sysdeps/sparc/fpu/feholdexcpt.c
@@ -31,5 +31,5 @@ feholdexcept (fenv_t *envp)
__fenv_ldfsr (tmp);
- return 1;
+ return 0;
}
diff --git a/sysdeps/sparc/fpu/fesetround.c b/sysdeps/sparc/fpu/fesetround.c
index 74963d7573..4b65179842 100644
--- a/sysdeps/sparc/fpu/fesetround.c
+++ b/sysdeps/sparc/fpu/fesetround.c
@@ -26,12 +26,12 @@ fesetround (int round)
if ((round & ~__FE_ROUND_MASK) != 0)
/* ROUND is no valid rounding mode. */
- return 0;
+ return 1;
__fenv_stfsr (tmp);
tmp &= ~__FE_ROUND_MASK;
tmp |= round;
__fenv_ldfsr (tmp);
- return 1;
+ return 0;
}