Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: hppa problems
- X-seq: zsh-workers 14838
- From: Andrej Borsenkow <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: Clint Adams <clint@xxxxxxx>
- Subject: Re: hppa problems
- Date: Mon, 11 Jun 2001 09:35:18 +0400 (MSD)
- Cc: <zsh-workers@xxxxxxxxxx>, <100336-forwarded@xxxxxxxxxxxxxxx>, <debian-hppa@xxxxxxxxxxxxxxxx>, <joy@xxxxxxxxxx>
- In-reply-to: <20010610201920.A18831@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
On Sun, 10 Jun 2001, Clint Adams wrote:
>
> > I'll investigate the sigsuspend test shortly.
>
> --sigsus.c--
> #include <signal.h>
> #include <unistd.h>
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author