1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* scripts/output-format.sed: Fix bug in one of the s expressions
	which used / for one too many things.
This commit is contained in:
Ulrich Drepper
2002-12-08 08:25:05 +00:00
parent 3335502bec
commit bdb04f9220
49 changed files with 289 additions and 248 deletions

View File

@ -1,5 +1,8 @@
2002-12-08 Ulrich Drepper <drepper@redhat.com> 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. * include/unistd.h: Declare __libc_close.
2002-12-07 Ulrich Drepper <drepper@redhat.com> 2002-12-07 Ulrich Drepper <drepper@redhat.com>

View File

@ -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> 2002-12-07 Ulrich Drepper <drepper@redhat.com>
* Makefile (CFLAGS-ftrylockfile.c): Add -D_IO_MTSAFE_IO. * Makefile (CFLAGS-ftrylockfile.c): Add -D_IO_MTSAFE_IO.

View File

@ -190,12 +190,12 @@ libpthread {
} }
# XXX Adjust number for final release. # XXX Adjust number for final release.
GLIBC_2.3.1 { GLIBC_2.3.2 {
# Proposed API extensions. # Proposed API extensions.
pthread_tryjoin_np; pthread_timedjoin_np; pthread_tryjoin_np; pthread_timedjoin_np;
creat; poll; pselect; readv; select; sigpause; sigsuspend; sigwait; creat; poll; pselect; readv; select; sigpause; sigsuspend; sigwait;
sigwaitinfo; waitid; writev; sigwaitinfo; waitid; writev; __xpg_sigpause;
} }
GLIBC_PRIVATE { GLIBC_PRIVATE {

View File

@ -20,6 +20,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <stdlib.h> #include <stdlib.h>
#include "pthreadP.h" #include "pthreadP.h"
#include "atomic.h"
/* This function is responsible for calling all registered cleanup /* 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;
}
}

View File

@ -27,12 +27,9 @@
int int
accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len) accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_accept (fd, addr, addr_len);
result = __libc_accept (fd, addr, addr_len);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
__close (int fd) __close (int fd)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (close, 1, fd); int result = INLINE_SYSCALL (close, 1, fd);
#else #else
result = __libc_close (fd); int result = __libc_close (fd);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
__connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t addr_len) __connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_connect (fd, addr, addr_len);
result = __libc_connect (fd, addr, addr_len);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,15 +28,12 @@
int int
creat (const char *pathname, mode_t mode) creat (const char *pathname, mode_t mode)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#if defined INLINE_SYSCALL && defined __NR_creat #if defined INLINE_SYSCALL && defined __NR_creat
result = INLINE_SYSCALL (creat, 2, pathname, mode); int result = INLINE_SYSCALL (creat, 2, pathname, mode);
#else #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 #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -30,18 +30,17 @@ int
__fcntl (int fd, int cmd, ...) __fcntl (int fd, int cmd, ...)
{ {
int oldtype; int oldtype;
int result;
va_list ap; va_list ap;
if (cmd == F_SETLKW) if (cmd == F_SETLKW)
CANCEL_ASYNC (oldtype); oldtype = CANCEL_ASYNC ();
va_start (ap, cmd); va_start (ap, cmd);
#ifdef INLINE_SYSCALL #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 #else
result = __libc_fcntl (fd, cmd, va_arg (ap, long int)); int result = __libc_fcntl (fd, cmd, va_arg (ap, long int));
#endif #endif
va_end (ap); va_end (ap);

View File

@ -27,15 +27,12 @@
int int
fsync (int fd) fsync (int fd)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (fsync, 1, fd); int result = INLINE_SYSCALL (fsync, 1, fd);
#else #else
result = __libc_fsync (fd); int result = __libc_fsync (fd);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
off_t off_t
__lseek (int fd, off_t offset, int whence) __lseek (int fd, off_t offset, int whence)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
off_t result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (lseek, 3, fd, offset, whence); off_t result = INLINE_SYSCALL (lseek, 3, fd, offset, whence);
#else #else
result = __libc_lseek (fd, offset, whence); off_t result = __libc_lseek (fd, offset, whence);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
off64_t off64_t
lseek64 (int fd, off64_t offset, int whence) lseek64 (int fd, off64_t offset, int whence)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
off64_t result;
CANCEL_ASYNC (oldtype); off64_t result = __libc_lseek64 (fd, offset, whence);
result = __libc_lseek64 (fd, offset, whence);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg);
result = __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,16 +28,13 @@
int int
msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype); #if defined INLINE_SYSCALL && defined __NR_ipc
int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
#ifdef INLINE_SYSCALL msgflg, (void *) msgp);
result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
msgflg, (void *) msgp);
#else #else
result = __libc_msgsnd (msqid, msgp, msgsz, msgflg); int result = __libc_msgsnd (msqid, msgp, msgsz, msgflg);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
msync (void *addr, size_t length, int flags) msync (void *addr, size_t length, int flags)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (msync, 3, addr, length, flags); int result = INLINE_SYSCALL (msync, 3, addr, length, flags);
#else #else
result = __libc_msync (addr, length, flags); int result = __libc_msync (addr, length, flags);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
__nanosleep (const struct timespec *requested_time, struct timespec *remaining) __nanosleep (const struct timespec *requested_time, struct timespec *remaining)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (nanosleep, 2, requested_time, remaining); int result = INLINE_SYSCALL (nanosleep, 2, requested_time, remaining);
#else #else
result = __libc_nanosleep (requested_time, remaining); int result = __libc_nanosleep (requested_time, remaining);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,20 +28,18 @@
int int
__open (const char *pathname, int flags, ...) __open (const char *pathname, int flags, ...)
{ {
int oldtype;
int result;
va_list ap; va_list ap;
va_start (ap, flags); va_start (ap, flags);
CANCEL_ASYNC (oldtype); int oldtype = CANCEL_ASYNC ();
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (open, 3, pathname, flags, int result = INLINE_SYSCALL (open, 3, pathname, flags,
va_arg (ap, __typeof ((mode_t) 0 + 0))); va_arg (ap, __typeof ((mode_t) 0 + 0)));
#else #else
result = __libc_open (pathname, flags, int result = __libc_open (pathname, flags,
va_arg (ap, __typeof ((mode_t) 0 + 0))); va_arg (ap, __typeof ((mode_t) 0 + 0)));
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -29,20 +29,18 @@
int int
__open64 (const char *pathname, int flags, ...) __open64 (const char *pathname, int flags, ...)
{ {
int oldtype;
int result;
va_list ap; va_list ap;
va_start (ap, flags); va_start (ap, flags);
CANCEL_ASYNC (oldtype); int oldtype = CANCEL_ASYNC ();
#if defined INLINE_SYSCALL && defined O_LARGEFILE #if defined INLINE_SYSCALL && defined O_LARGEFILE
result = INLINE_SYSCALL (open, 3, pathname, flags | O_LARGEFILE, int result = INLINE_SYSCALL (open, 3, pathname, flags | O_LARGEFILE,
va_arg (ap, __typeof ((mode_t) 0 + 0))); va_arg (ap, __typeof ((mode_t) 0 + 0)));
#else #else
result = __libc_open64 (pathname, flags, int result = __libc_open64 (pathname, flags,
va_arg (ap, __typeof ((mode_t) 0 + 0))); va_arg (ap, __typeof ((mode_t) 0 + 0)));
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
pause (void) pause (void)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_pause ();
result = __libc_pause ();
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
poll (struct pollfd *fds, nfds_t nfds, int timeout) poll (struct pollfd *fds, nfds_t nfds, int timeout)
{ {
int result; int oldtype =CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (poll, 3, fds, nfds, timeout); int result = INLINE_SYSCALL (poll, 3, fds, nfds, timeout);
#else #else
result = __poll (fds, nfds, timeout); int result = __poll (fds, nfds, timeout);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
pread (int fd, void *buf, size_t count, off_t offset) pread (int fd, void *buf, size_t count, off_t offset)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_pread (fd, buf, count, offset);
result = __libc_pread (fd, buf, count, offset);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
__pread64 (int fd, void *buf, size_t count, off64_t offset) __pread64 (int fd, void *buf, size_t count, off64_t offset)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_pread64 (fd, buf, count, offset);
result = __libc_pread64 (fd, buf, count, offset);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,12 +28,10 @@ int
pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *timeout, const sigset_t *sigmask) const struct timespec *timeout, const sigset_t *sigmask)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype); int result = __pselect (nfds, readfds, writefds, exceptfds, timeout,
sigmask);
result = __pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
pwrite (int fd, const void *buf, size_t count, off_t offset) pwrite (int fd, const void *buf, size_t count, off_t offset)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_pwrite (fd, buf, count, offset);
result = __libc_pwrite (fd, buf, count, offset);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
__pwrite64 (int fd, const void *buf, size_t count, off64_t offset) __pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_pwrite64 (fd, buf, count, offset);
result = __libc_pwrite64 (fd, buf, count, offset);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
ssize_t ssize_t
__read (int fd, void *buf, size_t count) __read (int fd, void *buf, size_t count)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (read, 3, fd, buf, count); ssize_t result = INLINE_SYSCALL (read, 3, fd, buf, count);
#else #else
result = __libc_read (fd, buf, count); ssize_t result = __libc_read (fd, buf, count);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -24,9 +24,11 @@
#include "pthreadP.h" #include "pthreadP.h"
/* Not all versions of the kernel support the large number of records. */ /* Not all versions of the kernel support extremely the large number
of records. */
#ifndef UIO_FASTIOV #ifndef UIO_FASTIOV
# define UIO_FASTIOV 8 /* 8 is a safe number. */ /* 1024 is what the kernels with NPTL support use. */
# define UIO_FASTIOV 1024
#endif #endif
@ -36,21 +38,29 @@ readv (fd, vector, count)
const struct iovec *vector; const struct iovec *vector;
int count; int count;
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result; ssize_t result;
CANCEL_ASYNC (oldtype);
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
result = INTERNAL_SYSCALL (readv, 3, fd, vector, count); result = INTERNAL_SYSCALL (readv, 3, fd, vector, count);
if (INTERNAL_SYSCALL_ERROR_P (result) if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result), 0))
&& __builtin_expect (count > UIO_FASTIOV, 0)) {
#elif defined INLINE_SYSCALL if (count <= UIO_FASTIOV)
{
__set_errno (INTERNAL_SYSCALL_ERRNO (result));
result = -1;
}
else
result = __libc_readv (fd, vector, count);
}
#else
# if defined INLINE_SYSCALL
result = INLINE_SYSCALL (readv, 3, fd, vector, count); result = INLINE_SYSCALL (readv, 3, fd, vector, count);
if (result < 0 && errno == EINVAL if (result < 0 && errno == EINVAL
&& __builtin_expect (count > UIO_FASTIOV, 0)) && __builtin_expect (count > UIO_FASTIOV, 0))
#endif # endif
result = __libc_readv (fd, vector, count); result = __libc_readv (fd, vector, count);
#endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
recv (int fd, __ptr_t buf, size_t n, int flags) recv (int fd, __ptr_t buf, size_t n, int flags)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_recv (fd, buf, n, flags);
result = __libc_recv (fd, buf, n, flags);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,12 +28,9 @@ ssize_t
recvfrom (int fd, __ptr_t buf, size_t n, int flags, __SOCKADDR_ARG addr, recvfrom (int fd, __ptr_t buf, size_t n, int flags, __SOCKADDR_ARG addr,
socklen_t *addr_len) socklen_t *addr_len)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_recvfrom (fd, buf, n, flags, addr, addr_len);
result = __libc_recvfrom (fd, buf, n, flags, addr, addr_len);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
recvmsg (int fd, struct msghdr *message, int flags) recvmsg (int fd, struct msghdr *message, int flags)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_recvmsg (fd, message, flags);
result = __libc_recvmsg (fd, message, flags);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,16 +28,13 @@ int
select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout) struct timeval *timeout)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#if defined INLINE_SYSCALL && defined __NR__newselect #if defined INLINE_SYSCALL && defined __NR__newselect
result = INLINE_SYSCALL (_newselect, 5, nfds, readfds, writefds, exceptfds, int result = INLINE_SYSCALL (_newselect, 5, nfds, readfds, writefds,
timeout); exceptfds, timeout);
#else #else
result = __select (nfds, readfds, writefds, exceptfds, timeout); int result = __select (nfds, readfds, writefds, exceptfds, timeout);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
__send (int fd, const __ptr_t buf, size_t n, int flags) __send (int fd, const __ptr_t buf, size_t n, int flags)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_send (fd, buf, n, flags);
result = __libc_send (fd, buf, n, flags);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
ssize_t ssize_t
sendmsg (int fd, const struct msghdr *message, int flags) sendmsg (int fd, const struct msghdr *message, int flags)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_sendmsg (fd, message, flags);
result = __libc_sendmsg (fd, message, flags);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,12 +28,9 @@ ssize_t
sendto (int fd, const __ptr_t buf, size_t n, int flags, sendto (int fd, const __ptr_t buf, size_t n, int flags,
__CONST_SOCKADDR_ARG addr, socklen_t addr_len) __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype); ssize_t result = __libc_sendto (fd, buf, n, flags, addr, addr_len);
result = __libc_sendto (fd, buf, n, flags, addr, addr_len);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,12 +28,22 @@
int int
sigpause (int mask) sigpause (int mask)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __sigpause (mask, 0);
result = sigpause (mask); CANCEL_RESET (oldtype);
return result;
}
int
__xpg_sigpause (int sig)
{
int oldtype = CANCEL_ASYNC ();
int result = __sigpause (sig, 1);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
sigsuspend (const sigset_t *set) sigsuspend (const sigset_t *set)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8); int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
#else #else
result = __sigsuspend (set); int result = __sigsuspend (set);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -28,15 +28,13 @@ int
sigtimedwait (const sigset_t *set, siginfo_t *info, sigtimedwait (const sigset_t *set, siginfo_t *info,
const struct timespec *timeout) const struct timespec *timeout)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, timeout, _NSIG / 8); int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, timeout,
_NSIG / 8);
#else #else
result = __sigtimedwait (set, info, timeout); int result = __sigtimedwait (set, info, timeout);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,13 +27,11 @@
int int
sigwait (const sigset_t *set, int *sig) sigwait (const sigset_t *set, int *sig)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
result = INTERNAL_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL, _NSIG / 8); int result = INTERNAL_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL,
_NSIG / 8);
if (! INTERNAL_SYSCALL_ERROR_P (result)) if (! INTERNAL_SYSCALL_ERROR_P (result))
{ {
*sig = result; *sig = result;
@ -42,7 +40,7 @@ sigwait (const sigset_t *set, int *sig)
else else
result = INTERNAL_SYSCALL_ERRNO (result); result = INTERNAL_SYSCALL_ERRNO (result);
#elif defined INLINE_SYSCALL #elif defined INLINE_SYSCALL
result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL, _NSIG / 8); int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, NULL, NULL, _NSIG / 8);
if (result != -1) if (result != -1)
{ {
*sig = result; *sig = result;
@ -51,7 +49,7 @@ sigwait (const sigset_t *set, int *sig)
else else
result = errno; result = errno;
#else #else
result = __sigwait (set, sig); int result = __sigwait (set, sig);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
int int
sigwaitinfo (const sigset_t *set, siginfo_t *info) sigwaitinfo (const sigset_t *set, siginfo_t *info)
{ {
int result; int oldtype = CANCEL_ASYNC ();
int oldtype;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, NULL, _NSIG / 8); int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set, info, NULL, _NSIG / 8);
#else #else
result = __sigwaitinfo (set, info); int result = __sigwaitinfo (set, info);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
system (const char *line) system (const char *line)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_system (line);
result = __libc_system (line);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
tcdrain (int fd) tcdrain (int fd)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __libc_tcdrain (fd);
result = __libc_tcdrain (fd);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
pid_t pid_t
__wait (__WAIT_STATUS_DEFN stat_loc) __wait (__WAIT_STATUS_DEFN stat_loc)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
pid_t result;
CANCEL_ASYNC (oldtype); pid_t result = __libc_wait (stat_loc);
result = __libc_wait (stat_loc);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
int int
waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options) waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
int result;
CANCEL_ASYNC (oldtype); int result = __waitid (idtype, id, infop, options);
result = __waitid (idtype, id, infop, options);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,12 +27,9 @@
pid_t pid_t
waitpid (pid_t pid, int *stat_loc, int options) waitpid (pid_t pid, int *stat_loc, int options)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
pid_t result;
CANCEL_ASYNC (oldtype); pid_t result = __libc_waitpid (pid, stat_loc, options);
result = __libc_waitpid (pid, stat_loc, options);
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -27,15 +27,12 @@
ssize_t ssize_t
__write (int fd, const void *buf, size_t count) __write (int fd, const void *buf, size_t count)
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result;
CANCEL_ASYNC (oldtype);
#ifdef INLINE_SYSCALL #ifdef INLINE_SYSCALL
result = INLINE_SYSCALL (write, 3, fd, buf, count); ssize_t result = INLINE_SYSCALL (write, 3, fd, buf, count);
#else #else
result = __libc_write (fd, buf, count); ssize_t result = __libc_write (fd, buf, count);
#endif #endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -26,7 +26,8 @@
/* Not all versions of the kernel support the large number of records. */ /* Not all versions of the kernel support the large number of records. */
#ifndef UIO_FASTIOV #ifndef UIO_FASTIOV
# define UIO_FASTIOV 8 /* 8 is a safe number. */ /* 1024 is what the kernels with NPTL support use. */
# define UIO_FASTIOV 1024
#endif #endif
@ -36,21 +37,29 @@ writev (fd, vector, count)
const struct iovec *vector; const struct iovec *vector;
int count; int count;
{ {
int oldtype; int oldtype = CANCEL_ASYNC ();
ssize_t result; ssize_t result;
CANCEL_ASYNC (oldtype);
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
result = INTERNAL_SYSCALL (writev, 3, fd, vector, count); result = INTERNAL_SYSCALL (writev, 3, fd, vector, count);
if (INTERNAL_SYSCALL_ERROR_P (result) if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result), 0))
&& __builtin_expect (count > UIO_FASTIOV, 0)) {
#elif defined INLINE_SYSCALL if (count <= UIO_FASTIOV)
{
__set_errno (INTERNAL_SYSCALL_ERRNO (result));
result = -1;
}
else
result = __libc_writev (fd, vector, count);
}
#else
# if defined INLINE_SYSCALL
result = INLINE_SYSCALL (writev, 3, fd, vector, count); result = INLINE_SYSCALL (writev, 3, fd, vector, count);
if (result < 0 && errno == EINVAL if (result < 0 && errno == EINVAL
&& __builtin_expect (count > UIO_FASTIOV, 0)) && __builtin_expect (count > UIO_FASTIOV, 0))
#endif # endif
result = __libc_writev (fd, vector, count); result = __libc_writev (fd, vector, count);
#endif
CANCEL_RESET (oldtype); CANCEL_RESET (oldtype);

View File

@ -79,11 +79,11 @@ extern int __pthread_debug attribute_hidden;
} while (0) } while (0)
/* Set cancellation mode to asynchronous. */ /* Set cancellation mode to asynchronous. */
#define CANCEL_ASYNC(oldtype) \ #define CANCEL_ASYNC() \
__pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype) __pthread_enable_asynccancel ()
/* Reset to previous cancellation mode. */ /* Reset to previous cancellation mode. */
#define CANCEL_RESET(oldtype) \ #define CANCEL_RESET(oldtype) \
__pthread_setcanceltype (oldtype, NULL) __pthread_disable_asynccancel (oldtype)
/* Function performing the cancellation. */ /* Function performing the cancellation. */
extern void __do_cancel (char *currentframe) extern void __do_cancel (char *currentframe)
@ -187,6 +187,8 @@ extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void),
void (*child) (void)); void (*child) (void));
extern int __pthread_kill (pthread_t threadid, int signo); extern int __pthread_kill (pthread_t threadid, int signo);
extern int __pthread_setcanceltype (int type, int *oldtype); extern int __pthread_setcanceltype (int type, int *oldtype);
extern int __pthread_enable_asynccancel (void) attribute_hidden;
extern void __pthread_disable_asynccancel (int oldtype) attribute_hidden;
/* Special versions which use non-exported functions. */ /* Special versions which use non-exported functions. */
extern void _GI_pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, extern void _GI_pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,

View File

@ -33,7 +33,7 @@ sem_unlink (name)
size_t namelen; size_t namelen;
/* Determine where the shmfs is mounted. */ /* Determine where the shmfs is mounted. */
INTDEF(__pthread_once) (&__namedsem_once, __where_is_shmfs); INTUSE(__pthread_once) (&__namedsem_once, __where_is_shmfs);
/* If we don't know the mount points there is nothing we can do. Ever. */ /* If we don't know the mount points there is nothing we can do. Ever. */
if (mountpoint.dir == NULL) if (mountpoint.dir == NULL)

View File

@ -18,7 +18,7 @@ G
s/\n// s/\n//
s/^\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\1)/p s/^\([^,]*\),\([^,]*\),B/OUTPUT_FORMAT(\1)/p
s/^\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\2)/p s/^\([^,]*\),\([^,]*\),L/OUTPUT_FORMAT(\2)/p
/,/s/^/*** BUG in libc/scripts/output-format.sed *** /p /,/s|^|*** BUG in libc/scripts/output-format.sed *** |p
q q
: q : q
s/"//g s/"//g