Date: Fri, 16 Feb 2001 01:00:34 -0800 (PST) From: jagarl@creator.club.ne.jp To: freebsd-gnats-submit@FreeBSD.org Subject: bin/25132: sigprocmask problem with pthread Message-ID: <200102160900.f1G90Yx72349@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 25132 >Category: bin >Synopsis: sigprocmask problem with pthread >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 16 01:10:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Kazunori Ueno >Release: 4.2-RELEASE >Organization: Univ. of Tokyo, Japan >Environment: FreeBSD KitzBSD.chem.t.u-tokyo.ac.jp 4.2-RELEASE FreeBSD 4.2-RELEASE #1: Mon Jan 15 20:14:10 JST 2001 root@KitzBSD.chem.t.u-tokyo.ac.jp:/usr/src/sys/compile/KitzBSD i386 >Description: I want to block a signal by sigprocmask, but the signal is not blocked. Following description is for SIGTERM signal. In pthread library, signal is trapped by thread_sig_handler(). If the signal mask is set, the signal blocks in the handler. But thread_init() sets thread_sig_hander() as signal handler only for _SCHED_SIGNAL, SIGINFO and SIGCHLD. When the SIGTERM signal is caught, the signal is processed in kernel and default handler (kill process) is called. If I set some signal hander for SIGTERM, then thread_sig_handler() is used as the signal handler for SIGTERM. Then the signal mask is correctly used. >How-To-Repeat: Compile this program with -pthread option. For example, cc test.c -pthread This program should block 'SIGTERM' signal, but 'kill -TERM pid' kills this program. #include <signal.h> int main() { sigset_t tset; sigemptyset(&tset); sigaddset(&tset, SIGTERM); sigprocmask(SIG_BLOCK,&tset,NULL); while(1) ; } But this program correctly blocks the signal. #include <signal.h> void handler(int sig) { _exit(0); } int main() { sigset_t tset; sigemptyset(&tset); sigaddset(&tset, SIGTERM); sigprocmask(SIG_BLOCK,&tset,NULL); signal(SIGTERM,handler); while(1) ; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102160900.f1G90Yx72349>