File: sigs.c

package info (click to toggle)
diablo 1.16.test2-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 1,504 kB
  • ctags: 1,603
  • sloc: ansic: 17,654; perl: 2,054; sh: 260; csh: 118; makefile: 73
file content (30 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

/*
 * LIB/SIGS.C
 *
 * (c)Copyright 1997, Matthew Dillon, All Rights Reserved.  Refer to
 *    the COPYRIGHT file in the base directory of this distribution 
 *    for specific rights granted.
 */

#include "defs.h"

Prototype void rsignal(int sigNo, void (*func)(int sigNo));

void 
rsignal(int sigNo, void (*func)(int sigNo))
{
    struct sigaction sa = { 0 };

#ifndef SUNOS
    sa.sa_flags = SA_RESTART;	/* do not set SA_RESETHAND */
#endif
    sa.sa_handler = func;
    sigaddset(&sa.sa_mask, sigNo);

    if (sigaction(sigNo, &sa, NULL) < 0) {
	perror("sigaction");
	exit(1);
    }
}