aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--nptl/ChangeLog55
-rw-r--r--nptl/Versions4
-rw-r--r--nptl/cancellation.c62
-rw-r--r--nptl/pt-accept.c7
-rw-r--r--nptl/pt-close.c9
-rw-r--r--nptl/pt-connect.c7
-rw-r--r--nptl/pt-creat.c9
-rw-r--r--nptl/pt-fcntl.c7
-rw-r--r--nptl/pt-fsync.c9
-rw-r--r--nptl/pt-lseek.c9
-rw-r--r--nptl/pt-lseek64.c7
-rw-r--r--nptl/pt-msgrcv.c7
-rw-r--r--nptl/pt-msgsnd.c13
-rw-r--r--nptl/pt-msync.c9
-rw-r--r--nptl/pt-nanosleep.c9
-rw-r--r--nptl/pt-open.c12
-rw-r--r--nptl/pt-open64.c12
-rw-r--r--nptl/pt-pause.c7
-rw-r--r--nptl/pt-poll.c9
-rw-r--r--nptl/pt-pread.c7
-rw-r--r--nptl/pt-pread64.c7
-rw-r--r--nptl/pt-pselect.c8
-rw-r--r--nptl/pt-pwrite.c7
-rw-r--r--nptl/pt-pwrite64.c7
-rw-r--r--nptl/pt-read.c9
-rw-r--r--nptl/pt-readv.c30
-rw-r--r--nptl/pt-recv.c7
-rw-r--r--nptl/pt-recvfrom.c7
-rw-r--r--nptl/pt-recvmsg.c7
-rw-r--r--nptl/pt-select.c11
-rw-r--r--nptl/pt-send.c7
-rw-r--r--nptl/pt-sendmsg.c7
-rw-r--r--nptl/pt-sendto.c7
-rw-r--r--nptl/pt-sigpause.c18
-rw-r--r--nptl/pt-sigsuspend.c9
-rw-r--r--nptl/pt-sigtimedwait.c10
-rw-r--r--nptl/pt-sigwait.c12
-rw-r--r--nptl/pt-sigwaitinfo.c9
-rw-r--r--nptl/pt-system.c7
-rw-r--r--nptl/pt-tcdrain.c7
-rw-r--r--nptl/pt-wait.c7
-rw-r--r--nptl/pt-waitid.c7
-rw-r--r--nptl/pt-waitpid.c7
-rw-r--r--nptl/pt-write.c9
-rw-r--r--nptl/pt-writev.c27
-rw-r--r--nptl/pthreadP.h8
-rw-r--r--nptl/sem_unlink.c2
-rw-r--r--scripts/output-format.sed2
49 files changed, 288 insertions, 247 deletions
diff --git a/ChangeLog b/ChangeLog
index e8e14deb3c..879f9ba959 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2002-12-08 Ulrich Drepper <drepper@redhat.com>
+ * scripts/output-format.sed: Fix bug in one of the s expressions
+ which used / for one too many things.
+
* include/unistd.h: Declare __libc_close.
2002-12-07 Ulrich Drepper <drepper@redhat.com>
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d2544922a6..f9686e09cb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,58 @@
+2002-12-08 Ulrich Drepper <drepper@redhat.com>
+
+ * pthreadP.h: Declare __pthread_enable_asynccancel and
+ __pthread_disable_asynccancel.
+ (CANCEL_ASYNC): Use __pthread_enable_asynccancel.
+ (CANCEL_RESET): Use __pthread_disable_asynccancel.
+ * cancellation.c (__pthread_enable_asynccancel): New function.
+ (__pthread_disable_asynccancel): New function.
+ * pt-accept.c: Adjust for CANCEL_ASYNC and CANCEL_RESET change.
+ * pt-close.c: Likewise.
+ * pt-connect.c: Likewise.
+ * pt-creat.c: Likewise.
+ * pt-fcntl.c: Likewise.
+ * pt-fsync.c: Likewise.
+ * pt-lseek.c: Likewise.
+ * pt-lseek64.c: Likewise.
+ * pt-msgrcv.c: Likewise.
+ * pt-msgsnd.c: Likewise.
+ * pt-msync.c: Likewise.
+ * pt-nanosleep.c: Likewise.
+ * pt-open.c: Likewise.
+ * pt-open64.c: Likewise.
+ * pt-pause.c: Likewise.
+ * pt-poll.c: Likewise.
+ * pt-pread.c: Likewise.
+ * pt-pread64.c: Likewise.
+ * pt-pselect.c: Likewise.
+ * pt-pwrite.c: Likewise.
+ * pt-pwrite64.c: Likewise.
+ * pt-read.c: Likewise.
+ * pt-readv.c: Likewise.
+ * pt-recv.c: Likewise.
+ * pt-recvfrom.c: Likewise.
+ * pt-recvmsg.c: Likewise.
+ * pt-select.c: Likewise.
+ * pt-send.c: Likewise.
+ * pt-sendmsg.c: Likewise.
+ * pt-sendto.c: Likewise.
+ * pt-sigpause.c: Likewise.
+ * pt-sigsuspend.c: Likewise.
+ * pt-sigtimedwait.c: Likewise.
+ * pt-sigwait.c: Likewise.
+ * pt-sigwaitinfo.c: Likewise.
+ * pt-system.c: Likewise.
+ * pt-tcdrain.c: Likewise.
+ * pt-wait.c: Likewise.
+ * pt-waitid.c: Likewise.
+ * pt-waitpid.c: Likewise.
+ * pt-write.c: Likewise.
+ * pt-writev.c: Likewise.
+
+ * pt-sigpause.c (sigsuspend): Call __sigsuspend.
+ (__xpg_sigpause): New function.
+ * Versions (libpthread:GLIBC_2.3.2): Add __xpg_sigpause.
+
2002-12-07 Ulrich Drepper <drepper@redhat.com>
* Makefile (CFLAGS-ftrylockfile.c): Add -D_IO_MTSAFE_IO.
diff --git a/nptl/Versions b/nptl/Versions
index ce11c67295..e85db80a3a 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -190,12 +190,12 @@ libpthread {
}
# XXX Adjust number for final release.
- GLIBC_2.3.1 {
+ GLIBC_2.3.2 {
# Proposed API extensions.
pthread_tryjoin_np; pthread_timedjoin_np;
creat; poll; pselect; readv; select; sigpause; sigsuspend; sigwait;
- sigwaitinfo; waitid; writev;
+ sigwaitinfo; waitid; writev; __xpg_sigpause;
}
GLIBC_PRIVATE {
diff --git a/nptl/cancellation.c b/nptl/cancellation.c
index 890b26ec4e..3cdc574880 100644
--- a/nptl/cancellation.c
+++ b/nptl/cancellation.c
@@ -20,6 +20,7 @@
#include <setjmp.h>
#include <stdlib.h>
#include "pthreadP.h"
+#include "atomic.h"
/* This function is responsible for calling all registered cleanup
@@ -90,3 +91,64 @@ __cleanup_thread (struct pthread *self, char *currentframe)
}
}
}
+
+
+/* The next two functions are similar to pthread_setcanceltype() but
+ more specialized for the use in the cancelable functions like write().
+ They do not need to check parameters etc. */
+int
+attribute_hidden
+__pthread_enable_asynccancel (void)
+{
+ struct pthread *self = THREAD_SELF;
+ int oldval;
+
+ while (1)
+ {
+ oldval = THREAD_GETMEM (self, cancelhandling);
+ int newval = oldval | CANCELTYPE_BITMASK;
+
+ if (newval == oldval)
+ break;
+
+ if (atomic_compare_and_exchange_acq (&self->cancelhandling, newval,
+ oldval) == 0)
+ {
+ if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
+ {
+ THREAD_SETMEM (self, result, PTHREAD_CANCELED);
+ __do_cancel (CURRENT_STACK_FRAME);
+ }
+
+ break;
+ }
+ }
+
+ return oldval;
+}
+
+
+void
+attribute_hidden
+__pthread_disable_asynccancel (int oldtype)
+{
+ /* If asynchronous cancellation was enabled before we do not have
+ anything to do. */
+ if (oldtype & CANCELTYPE_BITMASK)
+ return;
+
+ struct pthread *self = THREAD_SELF;
+
+ while (1)
+ {
+ int oldval = THREAD_GETMEM (self, cancelhandling);
+ int newval = oldval & ~CANCELTYPE_BITMASK;
+
+ if (newval == oldval)
+ break;
+
+ if (atomic_compare_and_exchange_acq (&self->cancelhandling, newval,
+ oldval) == 0)
+ break;
+ }
+}
diff --git a/nptl/pt-accept.c b/nptl/pt-accept.c
index 09e2c52efd..1b25e9eff8 100644
--- a/nptl/pt-accept.c
+++ b/nptl/pt-accept.c
@@ -27,12 +27,9 @@
int
accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len)
{
- int oldtype;
- int result;
+ int oldtype = CANCEL_ASYNC ();
- CANCEL_ASYNC (oldtype);
-
- result = __libc_accept (fd, addr, addr_len);
+ int result = __libc_accept (fd, addr, addr_len);
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-close.c b/nptl/pt-close.c
index 85115c9c23..0edde5ea5d 100644
--- a/nptl/pt-close.c
+++ b/nptl/pt-close.c
@@ -27,15 +27,12 @@
int
__close (int fd)
{
- int oldtype;
- int result;
-
- CANCEL_ASYNC (oldtype);
+ int oldtype = CANCEL_ASYNC ();
#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (close, 1, fd);
+ int result = INLINE_SYSCALL (close, 1, fd);
#else
- result = __libc_close (fd);
+ int result = __libc_close (fd);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-connect.c b/nptl/pt-connect.c
index 105cb6218d..44d2e3ae21 100644
--- a/nptl/pt-connect.c
+++ b/nptl/pt-connect.c
@@ -27,12 +27,9 @@
int
__connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
{
- int oldtype;
- int result;
+ int oldtype = CANCEL_ASYNC ();
- CANCEL_ASYNC (oldtype);
-
- result = __libc_connect (fd, addr, addr_len);
+ int result = __libc_connect (fd, addr, addr_len);
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-creat.c b/nptl/pt-creat.c
index bdb5e4f561..f1783f1f60 100644
--- a/nptl/pt-creat.c
+++ b/nptl/pt-creat.c
@@ -28,15 +28,12 @@
int
creat (const char *pathname, mode_t mode)
{
- int result;
- int oldtype;
-
- CANCEL_ASYNC (oldtype);
+ int oldtype = CANCEL_ASYNC ();
#if defined INLINE_SYSCALL && defined __NR_creat
- result = INLINE_SYSCALL (creat, 2, pathname, mode);
+ int result = INLINE_SYSCALL (creat, 2, pathname, mode);
#else
- result = __libc_open (pathname, O_WRONLY|O_CREAT|O_TRUNC, mode);
+ int result = __libc_open (pathname, O_WRONLY|O_CREAT|O_TRUNC, mode);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-fcntl.c b/nptl/pt-fcntl.c
index 194f6ca52b..9d7f68e4c1 100644
--- a/nptl/pt-fcntl.c
+++ b/nptl/pt-fcntl.c
@@ -30,18 +30,17 @@ int
__fcntl (int fd, int cmd, ...)
{
int oldtype;
- int result;
va_list ap;
if (cmd == F_SETLKW)
- CANCEL_ASYNC (oldtype);
+ oldtype = CANCEL_ASYNC ();
va_start (ap, cmd);
#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (fcntl, 3, fd, cmd, va_arg (ap, long int));
+ int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, va_arg (ap, long int));
#else
- result = __libc_fcntl (fd, cmd, va_arg (ap, long int));
+ int result = __libc_fcntl (fd, cmd, va_arg (ap, long int));
#endif
va_end (ap);
diff --git a/nptl/pt-fsync.c b/nptl/pt-fsync.c
index 6c41912a7b..91fd266ed9 100644
--- a/nptl/pt-fsync.c
+++ b/nptl/pt-fsync.c
@@ -27,15 +27,12 @@
int
fsync (int fd)
{
- int oldtype;
- int result;
-
- CANCEL_ASYNC (oldtype);
+ int oldtype = CANCEL_ASYNC ();
#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (fsync, 1, fd);
+ int result = INLINE_SYSCALL (fsync, 1, fd);
#else
- result = __libc_fsync (fd);
+ int result = __libc_fsync (fd);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-lseek.c b/nptl/pt-lseek.c
index 31e3ef700e..9b530ea9e7 100644
--- a/nptl/pt-lseek.c
+++ b/nptl/pt-lseek.c
@@ -27,15 +27,12 @@
off_t
__lseek (int fd, off_t offset, int whence)
{
- int oldtype;
- off_t result;
-
- CANCEL_ASYNC (oldtype);
+ int oldtype = CANCEL_ASYNC ();
#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (lseek, 3, fd, offset, whence);
+ off_t result = INLINE_SYSCALL (lseek, 3, fd, offset, whence);
#else
- result = __libc_lseek (fd, offset, whence);
+ off_t result = __libc_lseek (fd, offset, whence);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-lseek64.c b/nptl/pt-lseek64.c
index f9faa16402..bdedd6e1cf 100644
--- a/nptl/pt-lseek64.c
+++ b/nptl/pt-lseek64.c
@@ -27,12 +27,9 @@
off64_t
lseek64 (int fd, off64_t offset, int whence)
{
- int oldtype;
- off64_t result;
+ int oldtype = CANCEL_ASYNC ();
- CANCEL_ASYNC (oldtype);
-
- result = __libc_lseek64 (fd, offset, whence);
+ off64_t result = __libc_lseek64 (fd, offset, whence);
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-msgrcv.c b/nptl/pt-msgrcv.c
index b8bf6bc56c..383cefaa40 100644
--- a/nptl/pt-msgrcv.c
+++ b/nptl/pt-msgrcv.c
@@ -27,12 +27,9 @@
int
msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg)
{
- int oldtype;
- int result;
+ int oldtype = CANCEL_ASYNC ();
- CANCEL_ASYNC (oldtype);
-
- result = __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg);
+ int result = __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg);
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-msgsnd.c b/nptl/pt-msgsnd.c
index 4297f9dc4e..bc09779c2e 100644
--- a/nptl/pt-msgsnd.c
+++ b/nptl/pt-msgsnd.c
@@ -28,16 +28,13 @@
int
msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{
- int result;
- int oldtype;
+ int oldtype = CANCEL_ASYNC ();
- CANCEL_ASYNC (oldtype);
-
-#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
- msgflg, (void *) msgp);
+#if defined INLINE_SYSCALL && defined __NR_ipc
+ int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
+ msgflg, (void *) msgp);
#else
- result = __libc_msgsnd (msqid, msgp, msgsz, msgflg);
+ int result = __libc_msgsnd (msqid, msgp, msgsz, msgflg);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-msync.c b/nptl/pt-msync.c
index c1d64454ca..18f3eeb284 100644
--- a/nptl/pt-msync.c
+++ b/nptl/pt-msync.c
@@ -27,15 +27,12 @@
int
msync (void *addr, size_t length, int flags)
{
- int oldtype;
- int result;
-
- CANCEL_ASYNC (oldtype);
+ int oldtype = CANCEL_ASYNC ();
#ifdef INLINE_SYSCALL
- result = INLINE_SYSCALL (msync, 3, addr, length, flags);
+ int result = INLINE_SYSCALL (msync, 3, addr, length, flags);
#else
- result = __libc_msync (addr, length, flags);
+ int result = __libc_msync (addr, length, flags);
#endif
CANCEL_RESET (oldtype);
diff --git a/nptl/pt-nanosleep.c b/nptl/pt-nanosleep.c
index 1d6cbb5170..91f111766a 100644
--- a/nptl/pt-nanosleep.c
+++ b/nptl/pt-nanosleep.c
@@ -27,15 +27,12 @@