summaryrefslogtreecommitdiff
path: root/lib/libc_r/TEST/test_pause.c
blob: be27ac8af50a4bf7fd438513c454b3ca320189b7 (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
/*	$OpenBSD: test_pause.c,v 1.3 2000/01/06 06:55:13 d Exp $	*/
/*
 * Test pause() 
 */
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include "test.h"

int gotsig = 0;

void
handler(sig) 
	int sig;
{
	printf("%s\n", strsignal(sig));
}

int
main()
{
	sigset_t all;
	pid_t self;

	ASSERT(signal(SIGHUP, handler) != SIG_ERR);
	CHECKe(self = getpid());
	CHECKe(sigemptyset(&all));
	CHECKe(sigaddset(&all, SIGHUP));
	CHECKe(sigprocmask(SIG_BLOCK, &all, NULL));
	CHECKe(kill(self, SIGHUP));
	CHECKe(pause());
	SUCCEED;
}