mouse@mcgill-vision.UUCP (04/02/87)
In article <276@pluto.UUCP>, warren@pluto.UUCP (Warren Burstein) writes: > I found undefined refs in a program that does job control to sighold, > sigrelse, and sigset. Are they part of BSD4.2, I believe those are 4.1c -ljobs routines. Under 4.2 they migrated into libc and got renamed: sighold to sigblock, sigrelse disappeared, sigset to sigvec. The arguments also changed somewhat. > what do they do, Been a while since I used 4.1. But as I recall, sighold blocks delivery of a signal but does not throw away instances the way sigignore does. Under 4.2, use sigblock instead. Sigrelse is necessary when longjmp()ing out of a signal handler. Under 4.2 this is handled correctly by longjmp, so sigrelse vanished. Sigset was the primitive for installing a handler. Under 4.2, use signal() or sigvec(). > and can I replace them with something? You don't say what operating system you want the replacements to run under, so I can't help you. Above are rough equivalents for 4.2 and 4.3, though I think the arguments have changed. der Mouse Smart mailers: mouse@mcgill-vision.uucp USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse think!mosart!mcgill-vision!mouse ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu
chris@mimsy.UUCP (04/09/87)
>In article <276@pluto.UUCP>, warren@pluto.UUCP (Warren Burstein) writes: >> I found undefined refs in a program that does job control to sighold, >> sigrelse, and sigset. Are they part of BSD4.2, In article <722@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes: >I believe those are 4.1c -ljobs routines. They date back to 4.1BSD. >Under 4.2 they migrated into libc and got renamed: sighold to sigblock, >sigrelse disappeared, sigrelse was replaced with sigsetmask, and sigpause was not renamed at all. >sigset to sigvec. The arguments also changed somewhat. Not quite: sigvec was `internal use only except after vfork' (horrid but true). >>what do they do, and can I replace them with something? Under 4.2 or 4.3BSD, use the following: #include <signal.h> #ifndef sigmask #define sigmask(s) (1 << ((s) - 1)) #endif #define sighold(s) (void) sigblock(sigmask(s)) #define sigrelse(s) (void) sigsetmask(sigblock(0) & ~sigmask(s)) #define sigset(s, d) signal(s, d) and replace calls to sigpause(SIGFOO) with sigpause(sigblock(0) & ~sigmask(SIGFOO)) You can save some system calls by changing code such as sighold(SIGCHLD); <stuff> sigrelse(SIGCHLD); to int omask = sigblock(sigmask(SIGCHLD)); <stuff> (void) sigsetmask(omask); Under other operating systems, you may be stuck with no way to handle signals reliably. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu
rml@hpfcdc.UUCP (04/16/87)
> #define sigrelse(s) (void) sigsetmask(sigblock(0) & ~sigmask(s))
More reliable (in a few rare corner cases):
#define sigrelse(s) (void) sigsetmask(sigblock(~0) & ~sigmask(s))
or
#define sigrelse(s) (void) sigsetmask(sigsetmask(~0) & ~sigmask(s))
Bob Lenk (hpfcla!rml)