zsh-workers
 help / color / mirror / code / Atom feed
From: Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
To: Clint Adams <clint@zsh.org>
Cc: <zsh-workers@sunsite.dk>, <100336-forwarded@bugs.debian.org>,
	<debian-hppa@lists.debian.org>, <joy@debian.org>
Subject: Re: hppa problems
Date: Mon, 11 Jun 2001 09:35:18 +0400 (MSD)	[thread overview]
Message-ID: <Pine.SV4.4.33.0106110928540.18037-100000@itsrm2.mow.siemens.ru> (raw)
In-Reply-To: <20010610201920.A18831@dman.com>

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


  parent reply	other threads:[~2001-06-11  5:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-10 11:07 PATCH: config.{guess,sub} upgrade Clint Adams
2001-06-10 12:10 ` hppa problems Clint Adams
2001-06-10 16:34   ` Bart Schaefer
2001-06-10 23:10     ` Clint Adams
2001-06-11  0:19       ` Clint Adams
2001-06-11  3:04         ` Bart Schaefer
2001-06-11 13:59           ` Clint Adams
2001-06-11  5:35         ` Andrej Borsenkow [this message]
2001-06-11  5:50           ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SV4.4.33.0106110928540.18037-100000@itsrm2.mow.siemens.ru \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=100336-forwarded@bugs.debian.org \
    --cc=clint@zsh.org \
    --cc=debian-hppa@lists.debian.org \
    --cc=joy@debian.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).