Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!ucsfcgl!babar.mmwb.ucsf.edu!srp From: srp@babar.mmwb.ucsf.edu (Scott R. Presnell%Cohen) Newsgroups: comp.unix.internals Subject: Re: sigblock,sigmask,sigsetmask ... for SYS V? Message-ID: Date: 22 Jun 91 19:56:25 GMT References: <1991Jun21.225851.24990@uokmax.ecn.uoknor.edu> Sender: daemon@cgl.ucsf.edu Lines: 61 hpn@regentdb.osrhe.uoknor.edu (Huy Nguyen / (405) 721-3798) writes: >Does anyone know of a library package, hacks, etc to emulate these BSD >signal routines for SYS V? >Huy Nguyen >hpn@regentdb.osrhe.uoknor.edu I've used the following in the past as a quick hack (NSIG can usually be found in /usr/include/sys/signals.h): /* Mask of held signals */ static int sigheld = 0; int sigblock (sigs) int sigs; { int i,old; for (i = 0; i < NSIG; i++) if (sigs & sigbit (i)) sighold (i); old = sigheld; sigheld |= sigs; return(old); } sigsetmask(sigset) int sigset; { int newheld,newrel,tmp; newheld = sigset & ~sigheld; newrel = sigheld & ~sigset; tmp = sigblock(newheld); sigfree(newrel); } sigfree (sigs) int sigs; { int i; for (i = 0; i < NSIG; i++) if (sigs & sigbit (i)) sigrelse (i); sigheld &= ~sigs; } sigbit (i) int i; { return 1 << (i - 1); } Hope this helps. - Scott Presnell (srp@cgl.ucsf.edu) -- Scott Presnell +1 (415) 476-9890 Pharm. Chem., S-926 Internet: srp@cgl.ucsf.edu University of California UUCP: ...ucbvax!ucsfcgl!srp San Francisco, CA. 94143-0446 Bitnet: srp@ucsfcgl.bitnet