#ifndef lint
static char *RCSid = "$Header: signal.c,v 1.4 89/09/26 22:30:07 mr-frog Exp $";
#endif

/*
 * sig.c
 *
 * block and unblock signals for critical sections.
 *
 * Non-reentrant.
 */

#include "misc.h"
#include <signal.h>

u_int	mask;

blocksig()
{
	mask = sigsetmask(0xffffffff);
}

unblocksig()
{
	sigsetmask(mask);
}

#ifndef linux
#ifdef sys5
char	*sys_siglist[] = {
	"no signal",
	"interrupt",
	"quit",
	"illegal instruction",
	"trace trap",
	"IOT instruction",
	"system crash imminent",
	"floating point exception",
	"kill",
	"bus error",
	"segmentation violation",
	"bad argument to system call",
	"write on a pipe with no one to read it",
	"alarm clock",
	"software termination",
	"user defined signal 1",
	"user defined signal 2",
	"death of a child",
	"power-fail restart",
	"asychronous i/o",
	"PTY read/write",
	"I/O intervention required",
	"monitor mode granted",
	"monitor mode retracted",
	"sound ack",
	"data pending",
};
#else
extern	char *sys_siglist[];
#endif
#endif

char *
signame(sig)
	int	sig;
{
	if (sig <= 0 || sig > NSIG)
		return "bad signal";
	return sys_siglist[sig];
}
