about summary refs log tree commit diff
path: root/hurd/hurdsig.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-05-27 23:42:24 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-05-28 09:11:12 +0000
commitf9011787497a276f84ef79ae233992692a626dc7 (patch)
tree680f878010797f43048084ad75a59d26628866b6 /hurd/hurdsig.c
parent31563b68410ff8e9490c5aafca31ec71b38f87a5 (diff)
downloadglibc-f9011787497a276f84ef79ae233992692a626dc7.tar.gz
glibc-f9011787497a276f84ef79ae233992692a626dc7.tar.xz
glibc-f9011787497a276f84ef79ae233992692a626dc7.zip
hurd: Fix pselect atomicity
In case the signal arrives before the __mach_msg call, we need to catch
between the sigprocmask call and the __mach_msg call.  Let's just reuse
the support for sigsuspend to make the signal send a message that
our __mach_msg call will just receive.

* hurd/hurdselect.c (_hurd_select): Add sigport and ss variables. When
sigmask is not NULL, create a sigport port and register as
ss->suspended.  Add it to the portset.  When we receive a message on it,
set error to EINTR.  Clean up sigport and portset appropriately.

* hurd/hurdsig.c (wake_sigsuspend): Note that pselect also uses it.
Diffstat (limited to 'hurd/hurdsig.c')
-rw-r--r--hurd/hurdsig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index a2741bb7c8..4d819d9af2 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -564,8 +564,8 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live)
       }
 }
 
-/* Wake up any sigsuspend call that is blocking SS->thread.  SS must be
-   locked.  */
+/* Wake up any sigsuspend or pselect call that is blocking SS->thread.  SS must
+   be locked.  */
 static void
 wake_sigsuspend (struct hurd_sigstate *ss)
 {