diff options
author | Roland McGrath <roland@gnu.org> | 2006-07-31 07:17:01 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2006-07-31 07:17:01 +0000 |
commit | 518b2177f6c4f79e148414edf507a1aabab0e07b (patch) | |
tree | 8208ec657ac9776ade468a04bc9a8d60e8ab9e2a /sysdeps | |
parent | ab5823b4b6e760345d347b98830ccc75aa81bff6 (diff) | |
download | glibc-518b2177f6c4f79e148414edf507a1aabab0e07b.tar.gz glibc-518b2177f6c4f79e148414edf507a1aabab0e07b.tar.xz glibc-518b2177f6c4f79e148414edf507a1aabab0e07b.zip |
Updated to fedora-glibc-20060731T0706
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/posix/pause.c | 18 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/sigsuspend.c | 49 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/not-cancel.h | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c | 47 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sigsuspend.c | 29 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/sigsuspend.c | 1 |
7 files changed, 54 insertions, 113 deletions
diff --git a/sysdeps/posix/pause.c b/sysdeps/posix/pause.c index 8639e684f4..538c186ec0 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 f8f9563494..0000000000 --- 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 4a76335a55..80d33be29c 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 452f8354d0..0000000000 --- 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 7b9b60911b..adbdfddfdb 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 1f06e3d534..0000000000 --- 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 9c5c79e63e..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c> |