summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/lib/syssignal.c
blob: f8abfddfe4fd415792a8cd9e6447765abae63343 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>

#include "ntp_stdlib.h"

#if defined(NTP_POSIX_SOURCE)
#include <errno.h>

extern int errno;

void
signal_no_reset(sig, func)
int sig;
void (*func)();
{
    int n;
    struct sigaction vec;

    vec.sa_handler = func;
    sigemptyset(&vec.sa_mask);
    vec.sa_flags = 0;

    while (1) {
        n = sigaction(sig, &vec, NULL);
	if (n == -1 && errno == EINTR) continue;
	break;
    }
    if (n == -1) {
	perror("sigaction");
        exit(1);
    }
}

#else
RETSIGTYPE
signal_no_reset(sig, func)
int sig;
RETSIGTYPE (*func)();
{
    signal(sig, func);

}
#endif

OpenPOWER on IntegriCloud