summaryrefslogtreecommitdiffstats
path: root/regress/sys/kern/signal/sigio/common.h
blob: 8a93b6f751abe8189e2254d752ba15010148788e (plain) (blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*	$OpenBSD: common.h,v 1.1 2020/09/16 14:02:23 mpi Exp $	*/

/*
 * Copyright (c) 2018 Visa Hankala
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#define SIGIO_REGRESS_USER	"nobody"

/*
 * Wait until signal signum arrives, or fail if a timeout occurs first.
 */
#define expect_signal(signum) \
	expect_signal_impl(signum, #signum, __FILE__, __LINE__)

/*
 * Fail if signal signum is pending.
 */
#define reject_signal(signum) \
	reject_signal_impl(signum, #signum, __FILE__, __LINE__)

void	expect_signal_impl(int, const char *, const char *, int);
void	reject_signal_impl(int, const char *, const char *, int);

int	test_common_badpgid(int);
int	test_common_badsession(int);
int	test_common_cansigio(int *);
int	test_common_getown(int);
int	test_common_read(int *);
int	test_common_write(int *);
int	test_pipe_badpgid(void);
int	test_pipe_badsession(void);
int	test_pipe_cansigio(void);
int	test_pipe_getown(void);
int	test_pipe_read(void);
int	test_pipe_write(void);
int	test_socket_badpgid(void);
int	test_socket_badsession(void);
int	test_socket_cansigio(void);
int	test_socket_getown(void);
int	test_socket_inherit(void);
int	test_socket_read(void);
int	test_socket_write(void);

void	test_init(void);
void	test_barrier(int);
int	test_fork(pid_t *, int *);
int	test_wait(pid_t, int);
#define PARENT	1
#define CHILD	0