summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-11-02 12:26:42 +0000
committerJakub Jelinek <jakub@redhat.com>2004-11-02 12:26:42 +0000
commit80c96e8e6f452d6d9803f5a2e17030658f30afc4 (patch)
treeef584f35ed7167c7a680783415a66799c3789233 /nptl
parent0b5cfa4e0b7c9dc2cd81635307613c86c0f5e200 (diff)
Updated to fedora-glibc-20041102T1153
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog31
-rw-r--r--nptl/pthread_create.c6
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S16
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S49
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/smp.h7
6 files changed, 105 insertions, 14 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 2385b9cd37..31be4c37bb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,34 @@
+2004-10-29 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/sem_timedwait.S (sem_timedwait):
+ Set ETIMEDOUT to errno when time is up. Tweak to avoid
+ assembler warning.
+
+2004-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * pthread_create.c (__pthread_create_2_1): Avoid leaking stacks
+ if sched_priority is not between minprio and maxprio.
+
+2004-10-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+ (__pthread_cond_timedwait): Use clock_gettime syscall if exists.
+
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.S
+ (__lll_mutex_timedlock_wait): Fix a bad branch condition.
+
+2004-10-24 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/unix/sysv/linux/smp.h (is_smp_system): Use
+ not-cancelable I/O functions.
+
+2004-10-21 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/lowlevellock.S
+ (__lll_mutex_timedlock_wait): If woken but cannot get the lock,
+ make sure 2 is stored in the futex and we looked at the old value.
+ Fix a few other problems to return the correct value.
+
2004-10-14 Richard Henderson <rth@redhat.com>
* sysdeps/alpha/tcb-offsets.sym (thread_offsetof): Redefine to
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 1bab72d1e9..7293f4c71c 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -459,10 +459,12 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
err = create_thread (pd, iattr, STACK_VARIABLES_ARGS);
if (err != 0)
{
- errout:
/* Something went wrong. Free the resources. */
if (!is_detached)
- __deallocate_stack (pd);
+ {
+ errout:
+ __deallocate_stack (pd);
+ }
return err;
}
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
index 320fe18fe8..bcb15615e5 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S
@@ -117,6 +117,7 @@ __lll_mutex_timedlock_wait:
mov #1, r3
mov #2, r4
CMPXCHG (r3, @r8, r4, r2)
+ tst r2, r2
bt 8f
mov r8, r4
@@ -127,13 +128,14 @@ __lll_mutex_timedlock_wait:
extu.b r3, r3
trapa #0x14
SYSCALL_INST_PAD
- mov r0, r4
+ mov r0, r5
-8:
+8:
mov #0, r3
mov #2, r4
CMPXCHG (r3, @r8, r4, r2)
- bf 7f
+ bf/s 7f
+ mov #0, r0
6:
add #8, r15
@@ -144,8 +146,14 @@ __lll_mutex_timedlock_wait:
7:
/* Check whether the time expired. */
mov #-ETIMEDOUT, r1
- cmp/eq r4, r1
+ cmp/eq r5, r1
bt 5f
+
+ /* Make sure the current holder knows we are going to sleep. */
+ XCHG (r2, @r8, r3)
+ tst r3, r3
+ bt/s 6b
+ mov #0, r0
bra 1b
nop
3:
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index d0c55ecfef..74206a71ec 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -133,6 +133,34 @@ __pthread_cond_timedwait:
8:
/* Get current time. */
+#ifdef __NR_clock_gettime
+ /* Get the clock number. */
+ mov.l @(cond_nwaiters,r8), r4
+ mov #((1 << clock_bits) - 1), r0
+ and r0, r4
+ /* Only clocks 0 and 1 are allowed. Both are handled in the
+ kernel. */
+ mov r15, r5
+ add #16, r5
+ mov.w .L__NR_clock_gettime, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+# ifndef __ASSUME_POSIX_TIMERS
+ cmp/eq #-ENOSYS, r0
+ bt 19f
+# endif
+
+ /* Compute relative timeout. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ bra 0f
+ mov.l @(20,r15), r1
+.L__NR_clock_gettime:
+ .word __NR_clock_gettime
+
+# ifndef __ASSUME_POSIX_TIMERS
+19:
mov r15, r4
add #16, r4
mov #0, r5
@@ -143,11 +171,30 @@ __pthread_cond_timedwait:
/* Compute relative timeout. */
mov.l @(20,r15), r0
mov.w .L1k, r1
- dmulu.l r0, r1 /* Milli seconds to nano seconds. */
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
mov.l @r13, r2
mov.l @(4,r13), r3
mov.l @(16,r15), r0
sts macl, r1
+#endif
+0:
+#else
+ mov r15, r4
+ add #16, r4
+ mov #0, r5
+ mov #SYS_gettimeofday, r3
+ trapa #0x12
+ SYSCALL_INST_PAD
+
+ /* Compute relative timeout. */
+ mov.l @(20,r15), r0
+ mov.w .L1k, r1
+ dmulu.l r0, r1 /* Micro seconds to nano seconds. */
+ mov.l @r13, r2
+ mov.l @(4,r13), r3
+ mov.l @(16,r15), r0
+ sts macl, r1
+#endif
sub r0, r2
clrt
subc r1, r3
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
index 27a1bb019d..acb7d0f78b 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S
@@ -42,8 +42,10 @@ sem_timedwait:
mov #0xf9, r1
and r1, r0
cmp/eq #8, r0
- bt 10f
-
+ bf 0f
+ bra 10f
+ stc gbr, r0
+0:
mov.l @r4, r0
2:
tst r0, r0
@@ -115,7 +117,8 @@ sem_timedwait:
add #-1, r2
5:
cmp/pz r2
- bf 6f /* Time is already up. */
+ bf/s 6f /* Time is already up. */
+ mov #ETIMEDOUT, r0
/* Store relative timeout. */
mov.l r2, @r15
@@ -196,7 +199,6 @@ sem_timedwait:
10:
/* Canceled. */
- stc gbr, r0
mov.w .Lresult, r1
mov #-1, r2
mov.l r2, @(r0,r1)
diff --git a/nptl/sysdeps/unix/sysv/linux/smp.h b/nptl/sysdeps/unix/sysv/linux/smp.h
index 718fab683b..c1160a7939 100644
--- a/nptl/sysdeps/unix/sysv/linux/smp.h
+++ b/nptl/sysdeps/unix/sysv/linux/smp.h
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <string.h>
#include <sys/sysctl.h>
+#include <not-cancel.h>
/* Test whether the machine has more than one processor. This is not the
best test but good enough. More complicated tests would require `malloc'
@@ -37,13 +38,13 @@ is_smp_system (void)
buf, &reslen, NULL, 0) < 0)
{
/* This was not successful. Now try reading the /proc filesystem. */
- int fd = __open ("/proc/sys/kernel/version", O_RDONLY);
+ int fd = open_not_cancel_2 ("/proc/sys/kernel/version", O_RDONLY);
if (__builtin_expect (fd, 0) == -1
- || (reslen = __read (fd, buf, sizeof (buf))) <= 0)
+ || (reslen = read_not_cancel (fd, buf, sizeof (buf))) <= 0)
/* This also didn't work. We give up and say it's a UP machine. */
buf[0] = '\0';
- __close (fd);
+ close_not_cancel_no_status (fd);
}
return strstr (buf, "SMP") != NULL;