rktio: fix signal mask for subprocesses
... by making `centralized_unblock_child_signal` actually unblock SIGCHLD. Closes #2176
This commit is contained in:
parent
e2435d7187
commit
b40fdb7dd7
|
@ -543,6 +543,22 @@
|
|||
(close-input-port (car p))
|
||||
(close-input-port (cadddr p))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Check the process state for subprocesses to ensure that, for example,
|
||||
;; SIGCHLD is not blocked
|
||||
|
||||
(unless (eq? (system-type) 'windows)
|
||||
(let* ([dir (make-temporary-file "sub~a" 'directory)]
|
||||
[exe (build-path dir "check")])
|
||||
(when (system* (or (find-executable-path "cc")
|
||||
(find-executable-path "gcc"))
|
||||
"-o"
|
||||
exe
|
||||
(path->complete-path "unix_check.c" (or (current-load-relative-directory)
|
||||
(current-directory))))
|
||||
(test #t 'subprocess-state (system* exe)))
|
||||
(delete-directory/files dir)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(for ([f (list tmpfile tmpfile2)] #:when (file-exists? f)) (delete-file f))
|
||||
|
|
17
pkgs/racket-test-core/tests/racket/unix_check.c
Normal file
17
pkgs/racket-test-core/tests/racket/unix_check.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* Make sure a child process is started with normal properties, such
|
||||
as no blocked signals */
|
||||
|
||||
int main()
|
||||
{
|
||||
sigset_t set, old_set;
|
||||
sigemptyset(&set);
|
||||
sigprocmask(SIG_BLOCK, &set, &old_set);
|
||||
|
||||
return (sigismember(&old_set, SIGCHLD)
|
||||
|| sigismember(&old_set, SIGINT)
|
||||
|| sigismember(&old_set, SIGHUP)
|
||||
|| sigismember(&old_set, SIGQUIT));
|
||||
}
|
|
@ -392,6 +392,10 @@ void centralized_block_child_signal()
|
|||
|
||||
void centralized_unblock_child_signal()
|
||||
{
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGCHLD);
|
||||
sigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||
}
|
||||
|
||||
void centralized_start_child_signal_handler()
|
||||
|
|
Loading…
Reference in New Issue
Block a user