[comp.unix.programmer] Problems with signal handler

ronald@robobar.co.uk (Ronald S H Khoo) (01/24/91)

allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes:

> free list.)  (Actually, most modern Unixes allow signals to be "held", so that
> critical operations like this can complete before the signal trap executes.
> However, this is non-portable:  SVR3.2 does it differently from BSD4.3 does it
> differently from SunOS 4.x does it differently from ... you get the idea.  And
> you can't do it at all under Xenix or V7.

To pick a nit, SCO Xenix V.2.3 has sighold()/sigrelse().  Question:
where do these come from ? BSD 4.1 ?

Actually, what I'd really like to know is, is there an abstract interface to
"held" signals that maps reasonably well on top of all the seemingly
endless different kinds of signal interfaces ?  Or is it really the case
that all we can really use in half-portable code is just plain signal() ?

-- 
Ronald Khoo <ronald@robobar.co.uk> +44 81 991 1142 (O) +44 71 229 7741 (H)

richard@aiai.ed.ac.uk (Richard Tobin) (01/24/91)

In article <1991Jan23.183422.24871@robobar.co.uk> ronald@robobar.co.uk (Ronald S H Khoo) writes:
>To pick a nit, SCO Xenix V.2.3 has sighold()/sigrelse().  Question:
>where do these come from ? BSD 4.1 ?

Yup.  They were in the "jobs library" which went away in 4.2.

From jobs(3J):

 The facilities described here are used to support the job control
 implemented in csh(1) ... Because these facilities are not standard
 in UNIX and because the signal mechanisms are also slightly different,
 the associated routines are not in the standard C library ...

In 4.2, sighold() and sigrelse() were replaced with sigblock() and
sigsetmask(), and the job control facilities were integrated into
the standard library.

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin

src@scuzzy.in-berlin.de (Heiko Blume) (01/26/91)

ronald@robobar.co.uk (Ronald S H Khoo) writes:
>Actually, what I'd really like to know is, is there an abstract interface to
>"held" signals that maps reasonably well on top of all the seemingly
>endless different kinds of signal interfaces ?  Or is it really the case
>that all we can really use in half-portable code is just plain signal() ?

if you mean how to find out what (blocked) signals are pending (do you?)
posix has defined such an interface:

sigset_t set;				/* this object */
sigemptyset(&set);			/* must be initialized */
sigpending(&set);			/* to be filled with the pending-set */
if(sigismember(&set,SIGCHLD))		/* and tested for a specific signal */
   printf("SIGCHLD had been posted\n");
-- 
      Heiko Blume <-+-> src@scuzzy.in-berlin.de <-+-> (+49 30) 691 88 93
                    public source archive [HST V.42bis]:
        scuzzy Any ACU,f 38400 6919520 gin:--gin: nuucp sword: nuucp
                     uucp scuzzy!/src/README /your/home