Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!mimsy!chris From: chris@mimsy.UUCP Newsgroups: comp.unix.questions Subject: Re: Wanted: info about signal handling routines Message-ID: <6194@mimsy.UUCP> Date: Wed, 8-Apr-87 23:23:19 EST Article-I.D.: mimsy.6194 Posted: Wed Apr 8 23:23:19 1987 Date-Received: Sat, 11-Apr-87 10:36:12 EST References: <276@pluto.UUCP> <722@mcgill-vision.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 60 Keywords: sighold, sigrelse, sigset >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 #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); sigrelse(SIGCHLD); to int omask = sigblock(sigmask(SIGCHLD)); (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