|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 2349 (0x92d)
Types: TextFile
Names: »signals.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/compat/signals.c«
/* signals.c - signal handling */
#ifndef lint
static char *rcsid = "$Header: /f/osi/compat/RCS/signals.c,v 6.0 89/03/18 23:25:41 mrose Rel $";
#endif
/*
* $Header: /f/osi/compat/RCS/signals.c,v 6.0 89/03/18 23:25:41 mrose Rel $
*
*
* $Log: signals.c,v $
* Revision 6.0 89/03/18 23:25:41 mrose
* Release 5.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include <signal.h>
#ifndef BADSIG
#define BADSIG ((SFP) -1)
#endif
#include "manifest.h"
/* \f
Berkeley UNIX: 4.2 */
#ifdef BSDSIGS
/* Simply including <signal.h> is sufficient for everything but AIX */
#ifdef AIX /* #define'd to be _signal */
IFP signal (sig, func)
int sig;
IFP func;
{
struct sigvec sv1,
sv2;
sv1.sv_handler = func;
sv1.sv_mask = sv1.sv_onstack = 0;
return (sigvec (sig, &sv1, &sv2) != NOTOK ? sv2.sv_handler : BADSIG);
}
#endif
#else
/* \f
AT&T UNIX: 5 */
/* Probably a race condition or two in this code */
static int blocked = 0;
static int pending = 0;
static SFP handler[NSIG];
static int sigser (sig)
int sig;
{
(void) signal (sig, sigser);
pending |= sigmask (sig);
}
/* \f
*/
int sigblock (mask)
int mask;
{
register int sig,
smask;
long omask = blocked;
if (mask == 0)
return blocked;
for (sig = 1, smask = sigmask (sig); sig < NSIG; sig++, smask <<= 1)
if ((smask & mask) && !(smask & blocked)) {
pending &= ~smask;
handler[sig] = signal (sig, sigser);
blocked |= smask;
}
return omask;
}
int sigsetmask (mask)
int mask;
{
register int sig,
smask;
long omask = blocked;
for (sig = 1, smask = sigmask (sig); sig < NSIG; sig++, smask <<= 1)
if (smask & mask) {
if (smask & blocked)
continue;
pending &= ~smask;
handler[sig] = signal (sig, sigser);
blocked |= smask;
}
else
if (smask & blocked) {
blocked &= ~smask;
(void) signal (sig, handler[sig] != BADSIG ? handler[sig]
: SIG_DFL);
if (smask & pending) {
pending &= ~smask;
(void) kill (getpid (), sig);
}
}
return omask;
}
#endif