From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16921 invoked from network); 11 Jun 2001 05:35:47 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 11 Jun 2001 05:35:47 -0000 Received: (qmail 6203 invoked by alias); 11 Jun 2001 05:35:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14838 Received: (qmail 6192 invoked from network); 11 Jun 2001 05:35:23 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) Date: Mon, 11 Jun 2001 09:35:18 +0400 (MSD) From: Andrej Borsenkow X-X-Sender: To: Clint Adams cc: , <100336-forwarded@bugs.debian.org>, , Subject: Re: hppa problems In-Reply-To: <20010610201920.A18831@dman.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 10 Jun 2001, Clint Adams wrote: > > > I'll investigate the sigsuspend test shortly. > > --sigsus.c-- > #include > #include > int child=0; > void handler(sig) > int sig; > {if(sig==SIGCHLD) child=1;} > main() { > struct sigaction act; > sigset_t set; > int pid, ret; > act.sa_handler = &handler; > sigfillset(&act.sa_mask); > act.sa_flags = 0; > sigaction(SIGCHLD, &act, 0); > sigfillset(&set); > sigprocmask(SIG_SETMASK, &set, 0); > pid=fork(); > if(pid==0) return 0; > if(pid>0) { > sigemptyset(&set); > ret=sigsuspend(&set); > exit(child==0); > } > } Hmm ... 1. POSIX defines two ways to call signal handler. If SA_SIGINFO flag is not set it is void func(int sig); if SA_SIGINFO is set it is void func(int, siginfo_t *, ucontext_t *) (the last one may be just void *). 2. The code is inherently non-portable due to: "If the signal occurs other than as the result of calling abort(), kill() or raise(), the behavior is undefined if the signal handler calls any function in the standard library other than one of the func- tions listed in the table above or refers to any object with static storage duration other than by assigning a value to a static storage duration variable of type volatile sig_atomic_t. Furthermore, if such a call fails, the value of errno is indeterminate." 3. There is an obvious race condition here (between call to sigsuspend and child exit). What do we try to test here at all? -andrej