mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
* 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.
This commit is contained in:
parent
b32e6700d0
commit
b894c2ea7e
21
ChangeLog
21
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
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
@ -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)
|
||||
|
@ -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)
|
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
#include "../../ia64/sigsuspend.c"
|
@ -1 +0,0 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>
|
Loading…
Reference in New Issue
Block a user