aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--include/signal.h3
-rw-r--r--nptl/ChangeLog13
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/pthread_mutex_lock.c3
-rw-r--r--nptl/pthread_mutex_timedlock.c4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h12
-rw-r--r--sysdeps/posix/pause.c18
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigsuspend.c49
-rw-r--r--sysdeps/unix/sysv/linux/not-cancel.h22
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c47
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c29
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigsuspend.c1
14 files changed, 109 insertions, 116 deletions
diff --git a/ChangeLog b/ChangeLog
index e603347..7d172ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2006-07-30 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/sysv/linux/ia64/sigsuspend.c: File removed.
+ * sysdeps/unix/sysv/linux/x86_64/sigsuspend.c: File removed.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c: File removed.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c: File removed.
+
+ * sysdeps/unix/sysv/linux/not-cancel.h (pause_not_cancel): New macro.
+ (nanosleep_not_cancel): New macro.
+ (sigsuspend_not_cancel): new macro.
+ * sysdeps/unix/sysv/linux/sigsuspend.c [__ASSUME_REALTIME_SIGNALS]
+ (do_sigsuspend): Define as inline.
+ (__sigsuspend): Always use do_sigsuspend.
+ [! NO_CANCELLATION] (__sigsuspend_nocancel): New function.
+ * include/signal.h: Declare __sigsuspend_nocancel.
+ * sysdeps/posix/pause.c
+ [! NO_CANCELLATION] (__pause_nocancel): New function.
+
+ * include/unistd.h (__pause_nocancel): Add attribute_hidden.
+ * include/time.h (__nanosleep_nocancel): Likewise.
+
2006-07-30 Ulrich Drepper <drepper@redhat.com>
* locale/programs/localedef.c (add_to_readlist): Rename local
diff --git a/include/signal.h b/include/signal.h
index 2be67ba..6bbfbcf 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -26,6 +26,9 @@ extern int __sigprocmask (int __how,
__const sigset_t *__set, sigset_t *__oset);
extern int __sigsuspend (__const sigset_t *__set);
libc_hidden_proto (__sigsuspend)
+#ifndef NO_CANCELLATION
+extern int __sigsuspend_nocancel (__const sigset_t *__set) attribute_hidden;
+#endif
extern int __sigwait (__const sigset_t *__set, int *__sig);
libc_hidden_proto (__sigwait)
extern int __sigwaitinfo (__const sigset_t *__set, siginfo_t *__info);
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 46a7f33..0ee39ed 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,16 @@
+2006-07-30 Roland McGrath <roland@redhat.com>
+
+ * Makefile (libpthread-routines): Add ptw-sigsuspend.
+
+ * sysdeps/unix/sysv/linux/i386/not-cancel.h
+ (pause_not_cancel): New macro.
+ (nanosleep_not_cancel): New macro.
+ (sigsuspend_not_cancel): New macro.
+ * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Use
+ nanosleep_not_cancel macro from <not-cancel.h>.
+ * pthread_mutex_lock.c (__pthread_mutex_lock): Use pause_not_cancel
+ macro from <not-cancel.h>.
+
2006-07-28 Ulrich Drepper <drepper@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/nptl/Makefile b/nptl/Makefile
index a4c6174..4023e46 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -108,7 +108,7 @@ libpthread-routines = init vars events version \
ptw-msync ptw-nanosleep ptw-open ptw-open64 ptw-pause \
ptw-pread ptw-pread64 ptw-pwrite ptw-pwrite64 \
ptw-tcdrain ptw-wait ptw-waitpid ptw-msgrcv ptw-msgsnd \
- ptw-sigwait \
+ ptw-sigwait ptw-sigsuspend \
pt-raise pt-system \
flockfile ftrylockfile funlockfile \
sigaction \
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index 5345766..a19c907 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <not-cancel.h>
#include "pthreadP.h"
#include <lowlevellock.h>
@@ -278,7 +279,7 @@ __pthread_mutex_lock (mutex)
/* Delay the thread indefinitely. */
while (1)
- __pause_nocancel ();
+ pause_not_cancel ();
}
oldval = mutex->__data.__lock;
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 12f6c99..dcff4f8 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -19,8 +19,10 @@
#include <assert.h>
#include <errno.h>
+#include <time.h>
#include "pthreadP.h"
#include <lowlevellock.h>
+#include <not-cancel.h>
int
@@ -281,7 +283,7 @@ pthread_mutex_timedlock (mutex, abstime)
--reltime.tv_sec;
}
if (reltime.tv_sec >= 0)
- while (__nanosleep_nocancel (&reltime, &reltime) != 0)
+ while (nanosleep_not_cancel (&reltime, &reltime) != 0)
continue;
return ETIMEDOUT;
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h
index 9158494..6557359 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h
@@ -91,3 +91,15 @@ extern int __openat64_nocancel (int fd, const char *fname, int oflag,
# define waitpid_not_cancel(pid, stat_loc, options) \
INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
#endif
+
+/* Uncancelable pause. */
+#define pause_not_cancel() \
+ __pause_nocancel ()
+
+/* Uncancelable nanosleep. */
+#define nanosleep_not_cancel(requested_time, remaining) \
+ __nanosleep_nocancel (requested_time, remaining)
+
+/* Uncancelable sigsuspend. */
+#define sigsuspend_not_cancel(set) \
+ __sigsuspend_nocancel (set)
diff --git a/sysdeps/posix/pause.c b/sysdeps/posix/pause.c
index 8639e68..538c186 100644
--- a/sysdeps/posix/pause.c
+++ b/sysdeps/posix/pause.c
@@ -1,5 +1,5 @@
/* pause -- suspend the process until a signal arrives. POSIX.1 version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +23,7 @@
/* Suspend the process until a signal arrives.
This always returns -1 and sets errno to EINTR. */
+
int
__libc_pause (void)
{
@@ -39,3 +40,18 @@ __libc_pause (void)
weak_alias (__libc_pause, pause)
LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */
+
+#ifndef NO_CANCELLATION
+# include <not-cancel.h>
+
+int
+__pause_nocancel (void)
+{
+ sigset_t set;
+
+ __sigemptyset (&set);
+ __sigprocmask (SIG_BLOCK, NULL, &set);
+
+ return sigsuspend_not_cancel (&set);
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/sigsuspend.c b/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
deleted file mode 100644
index f8f9563..0000000
--- a/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-/* Change the set of blocked signals to SET,
- wait until a signal arrives, and restore the set of blocked signals. */
-int
-__sigsuspend (set)
- const sigset_t *set;
-{
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- if (SINGLE_THREAD_P)
- return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 4a76335..80d33be 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -81,3 +81,25 @@ extern int __openat64_nocancel (int fd, const char *fname, int oflag,
# define waitpid_not_cancel(pid, stat_loc, options) \
INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
#endif
+
+/* Uncancelable pause. */
+#ifdef __NR_pause
+# define pause_not_cancel() \
+ INLINE_SYSCALL (pause, 0)
+#else
+# define pause_not_cancel() \
+ __pause_nocancel ()
+#endif
+
+/* Uncancelable nanosleep. */
+#ifdef __NR_nanosleep
+# define nanosleep_not_cancel(requested_time, remaining) \
+ INLINE_SYSCALL (nanosleep, 2, requested_time, remaining)
+#else
+# define nanosleep_not_cancel(requested_time, remaining) \
+ __nanosleep_nocancel (requested_time, remaining)
+#endif
+
+/* Uncancelable sigsuspend. */
+#define sigsuspend_not_cancel(set) \
+ __sigsuspend_nocancel (set)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
deleted file mode 100644
index 452f835..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* Change the set of blocked signals to SET,
- wait until a signal arrives, and restore the set of blocked signals. */
-int
-__sigsuspend (set)
- const sigset_t *set;
-{
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- if (SINGLE_THREAD_P)
- return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 7b9b609..adbdfdd 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -56,6 +56,12 @@ do_sigsuspend (const sigset_t *set)
return INLINE_SYSCALL (sigsuspend, 3, 0, 0, set->__val[0]);
}
+#else
+static inline int __attribute__ ((always_inline))
+do_sigsuspend (const sigset_t *set)
+{
+ return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
+}
#endif
/* Change the set of blocked signals to SET,
@@ -64,19 +70,6 @@ int
__sigsuspend (set)
const sigset_t *set;
{
-#if __ASSUME_REALTIME_SIGNALS
- if (SINGLE_THREAD_P)
- return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
- int oldtype = LIBC_CANCEL_ASYNC ();
-
- int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set),
- _NSIG / 8);
-
- LIBC_CANCEL_RESET (oldtype);
-
- return result;
-#else
if (SINGLE_THREAD_P)
return do_sigsuspend (set);
@@ -87,8 +80,16 @@ __sigsuspend (set)
LIBC_CANCEL_RESET (oldtype);
return result;
-#endif
}
libc_hidden_def (__sigsuspend)
weak_alias (__sigsuspend, sigsuspend)
strong_alias (__sigsuspend, __libc_sigsuspend)
+
+#ifndef NO_CANCELLATION
+int
+__sigsuspend_nocancel (set)
+ const sigset_t *set;
+{
+ return do_sigsuspend (set);
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
deleted file mode 100644
index 1f06e3d..0000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../ia64/sigsuspend.c"
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c b/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
deleted file mode 100644
index 9c5c79e..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>