Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site genrad.UUCP Path: utzoo!linus!security!genrad!john From: john@genrad.UUCP (John Nelson) Newsgroups: net.sources Subject: jobs emulator for 4.2 windows Message-ID: <3793@genrad.UUCP> Date: Tue, 10-Jan-84 12:25:41 EST Article-I.D.: genrad.3793 Posted: Tue Jan 10 12:25:41 1984 Date-Received: Wed, 11-Jan-84 03:55:49 EST Organization: GenRad, Bolton, Mass. Lines: 141 The Maryland Windows library source comes with a jobs.c file which emulates the BSD 4.1 signal mechinism on non-4.1 systems. I modified this source file for use with BSD 4.2 as well. The source file, below, will automatically detect a 4.2 system, and will provide different code on 4.2 systems vs. other systems. This code HAS been tried out, and so far, no one has complained of problems in the way it functions. Note that you might have to modify the Makefile line "JOBSOBS" to be JOBSOBS=jobs.o if you are converting from a 4.1 system to a 4.2 system. Also, this jobs emulator source file might prove useful in converting other programs that use the 4.1 jobs library. ######## delete this line and all text above for the file "jobs.c" ######## #include /* Copyright (c) 1983 University of Maryland Computer Science Department */ /* * Jobs library emulator using old signal mechanism * * Added Jobs library emulator for BSD4.2 (genrad!john 01/10/84) * * 26 March 1983 ACT * * held_sigs == the signals held via sighold() * executing_sigs == the signals held because the signal handler is already * running * pending_sigs == the signals pending, for sigrelse() or whatever */ #ifdef SIGVTALRM #define BSD42 #endif #ifdef BSD42 typedef int (*FUNCPTR)(); FUNCPTR sigset (signo, f) register signo; FUNCPTR f; { FUNCPTR signal(); return signal(signo, f); } FUNCPTR sigignore (signo) int signo; { return sigset (signo, SIG_IGN); } sighold (signo) int signo; { sigblock (1 << (signo - 1)); } sigrelse (signo) int signo; { sigsetmask (sigblock(0) & ~(1 << (signo - 1))); } #else not BSD42 static long held_sigs, pending_sigs, executing_sigs; static int (*sigfuncs[32])(); int sigcatch(); int (*sigset (signo, f))() register signo; int (*f)(); { int (*rv)() = sigfuncs[signo]; if (f == SIG_DFL || f == SIG_IGN) { /* these are just zap-em-ins */ sigfuncs[signo] = f; signal (signo, f); pending_sigs &= ~(1<