question about which sleep is noted in manual

Message ID ork31p7b9i.fsf@free.home
State Superseded
Headers

Commit Message

Alexandre Oliva Dec. 18, 2014, 5:55 a.m. UTC
  [copying the list]

On Dec 10, 2014, MaShimiao <mashimiao.fnst@cn.fujitsu.com> wrote:

> But as I know, differen't thread has different signal mask.

So, I have reviewed the sigprocmask notes, and I found out not only that
the BSD implementation of signals was removed, so a number of the notes
can go, but also that at least twice I failed to take into account the
thread-local nature of signal masks.  Big oops.

Thanks for catching this.

The patch below fixes all of these issues.

Ok to install?


for ChangeLog

	* manual/setjmp.texi (longjmp, sigsetjmp): Drop obsolete
	sigprocmask annotations.
	* manual/signal.texi (sigprocmask): Drop BSD-only race; the
	code is now gone, but the race was never there to begin with.
	(pause, sigsuspend, sigblock, sigpause): Adjust.
---
 manual/setjmp.texi |    4 ++--
 manual/signal.texi |   48 ++++++++++++++++++------------------------------
 2 files changed, 20 insertions(+), 32 deletions(-)
  

Comments

Ma Shimiao Dec. 19, 2014, 7:32 a.m. UTC | #1
On 12/18/2014 01:55 PM, Alexandre Oliva wrote:
> So, I have reviewed the sigprocmask notes, and I found out not only that
> the BSD implementation of signals was removed, so a number of the notes
> can go, but also that at least twice I failed to take into account the
> thread-local nature of signal masks.  Big oops.
> 
> Thanks for catching this.
> 
> The patch below fixes all of these issues.
LGTM.

Best regards
  

Patch

diff --git a/manual/setjmp.texi b/manual/setjmp.texi
index ec79c26..a4722a3 100644
--- a/manual/setjmp.texi
+++ b/manual/setjmp.texi
@@ -132,7 +132,7 @@  execution state of the program in @var{state} and returns zero.  If
 @c     that calls longjmp may run the same cleanups multiple times.
 @c    _JMPBUF_UNWINDS_ADJ ok
 @c    *cleanup_buf->__routine @ascuplugin
-@c  sigprocmask(SIG_SETMASK) dup @asulock/hurd @aculock/hurd
+@c  sigprocmask dup @asulock/hurd @aculock/hurd
 @c  __longjmp ok
 This function restores current execution to the state saved in
 @var{state}, and continues execution from the call to @code{setjmp} that
@@ -221,7 +221,7 @@  information about the set of blocked signals.
 @c sigsetjmp @asulock/hurd @aculock/hurd
 @c  __sigsetjmp(savemask) @asulock/hurd @aculock/hurd
 @c   __sigjmp_save(savemask) @asulock/hurd @aculock/hurd
-@c    sigprocmask(SIG_BLOCK probe) dup @asulock/hurd @aculock/hurd
+@c    sigprocmask dup @asulock/hurd @aculock/hurd
 This is similar to @code{setjmp}.  If @var{savesigs} is nonzero, the set
 of blocked signals is saved in @var{state} and will be restored if a
 @code{siglongjmp} is later performed with this @var{state}.
diff --git a/manual/signal.texi b/manual/signal.texi
index 77f3d7c..8f5ad98 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -2625,10 +2625,8 @@  Instead, use @code{pthread_sigmask}.
 @comment signal.h
 @comment POSIX.1
 @deftypefun int sigprocmask (int @var{how}, const sigset_t *restrict @var{set}, sigset_t *restrict @var{oldset})
-@safety{@prelim{}@mtunsafe{@mtasurace{:sigprocmask/bsd(SIG_UNBLOCK)}}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
-@c This takes the hurd_self_sigstate-returned object's lock on HURD.  On
-@c BSD, SIG_UNBLOCK is emulated with two sigblock calls, which
-@c introduces a race window.
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
+@c This takes the hurd_self_sigstate-returned object's lock on HURD.
 The @code{sigprocmask} function is used to examine or change the calling
 process's signal mask.  The @var{how} argument determines how the signal
 mask is changed, and must be one of the following values:
@@ -2979,17 +2977,14 @@  you use it.
 @comment unistd.h
 @comment POSIX.1
 @deftypefun int pause (void)
-@safety{@prelim{}@mtunsafe{@mtasurace{:sigprocmask/!bsd!linux}}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
-@c  The signal mask read by sigprocmask may be overridden by another
-@c  thread or by a signal handler before we call sigsuspend.  Is this a
-@c  safety issue?  Probably not.
-@c pause @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
+@c pause @asulock/hurd @aculock/hurd
 @c [ports/linux/generic]
 @c  syscall_pause ok
 @c [posix]
 @c  sigemptyset dup ok
-@c  sigprocmask(SIG_BLOCK) dup @asulock/hurd @aculock/hurd [no @mtasurace:sigprocmask/bsd(SIG_UNBLOCK)]
-@c  sigsuspend dup @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
+@c  sigprocmask dup @asulock/hurd @aculock/hurd
+@c  sigsuspend dup @asulock/hurd @aculock/hurd
 The @code{pause} function suspends program execution until a signal
 arrives whose action is either to execute a handler function, or to
 terminate the process.
@@ -3085,16 +3080,11 @@  signals be handled by their handlers.
 @comment signal.h
 @comment POSIX.1
 @deftypefun int sigsuspend (const sigset_t *@var{set})
-@safety{@prelim{}@mtunsafe{@mtasurace{:sigprocmask/!bsd!linux}}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
-@c sigsuspend @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
-@c [posix] @mtasurace:sigprocmask/!bsd!linux
-@c   saving and restoring the procmask is racy
-@c  sigprocmask(SIG_SETMASK) dup @asulock/hurd @aculock/hurd [no @mtasurace:sigprocmask/bsd(SIG_UNBLOCK)]
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
+@c sigsuspend @asulock/hurd @aculock/hurd
+@c [posix]
+@c  sigprocmask dup @asulock/hurd @aculock/hurd
 @c  pause @asulock/hurd @aculock/hurd
-@c [bsd]
-@c  sigismember dup ok
-@c  sigmask dup ok
-@c  sigpause dup ok [no @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd]
 @c [linux]
 @c  do_sigsuspend ok
 This function replaces the process's signal mask with @var{set} and then
@@ -3354,9 +3344,8 @@  specifies a mask that includes all the job-control stop signals.
 @deftypefun int sigblock (int @var{mask})
 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
 @c On most POSIX systems, this is a wrapper for sigprocmask(SIG_BLOCK).
-@c The exception are BSD systems other than 4.4, where it is a syscall.
 @c sigblock @asulock/hurd @aculock/hurd
-@c  sigprocmask(SIG_BLOCK) dup @asulock/hurd @aculock/hurd [no @mtasurace:sigprocmask/bsd(SIG_UNBLOCK)]
+@c  sigprocmask dup @asulock/hurd @aculock/hurd
 This function is equivalent to @code{sigprocmask} (@pxref{Process Signal
 Mask}) with a @var{how} argument of @code{SIG_BLOCK}: it adds the
 signals specified by @var{mask} to the calling process's set of blocked
@@ -3368,9 +3357,8 @@  signals.  The return value is the previous set of blocked signals.
 @deftypefun int sigsetmask (int @var{mask})
 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
 @c On most POSIX systems, this is a wrapper for sigprocmask(SIG_SETMASK).
-@c The exception are BSD systems other than 4.4, where it is a syscall.
 @c sigsetmask @asulock/hurd @aculock/hurd
-@c  sigprocmask(SIG_SETMASK) dup @asulock/hurd @aculock/hurd [no @mtasurace:sigprocmask/bsd(SIG_UNBLOCK)]
+@c  sigprocmask dup @asulock/hurd @aculock/hurd
 This function equivalent to @code{sigprocmask} (@pxref{Process
 Signal Mask}) with a @var{how} argument of @code{SIG_SETMASK}: it sets
 the calling process's signal mask to @var{mask}.  The return value is
@@ -3380,15 +3368,15 @@  the previous set of blocked signals.
 @comment signal.h
 @comment BSD
 @deftypefun int sigpause (int @var{mask})
-@safety{@prelim{}@mtunsafe{@mtasurace{:sigprocmask/!bsd!linux}}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
-@c sigpause @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
+@safety{@prelim{}@mtsafe{}@asunsafe{@asulock{/hurd}}@acunsafe{@aculock{/hurd}}}
+@c sigpause @asulock/hurd @aculock/hurd
 @c [posix]
-@c  __sigpause @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
-@c   do_sigpause @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
-@c    sigprocmask(0) dup @asulock/hurd @aculock/hurd [no @mtasurace:sigprocmask/bsd(SIG_UNBLOCK)]
+@c  __sigpause @asulock/hurd @aculock/hurd
+@c   do_sigpause @asulock/hurd @aculock/hurd
+@c    sigprocmask dup @asulock/hurd @aculock/hurd
 @c    sigdelset dup ok
 @c    sigset_set_old_mask dup ok
-@c    sigsuspend dup @mtasurace:sigprocmask/!bsd!linux @asulock/hurd @aculock/hurd
+@c    sigsuspend dup @asulock/hurd @aculock/hurd
 This function is the equivalent of @code{sigsuspend} (@pxref{Waiting
 for a Signal}):  it sets the calling process's signal mask to @var{mask},
 and waits for a signal to arrive.  On return the previous set of blocked