xref: /netbsd-src/tests/kernel/tty/t_pr.c (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: t_pr.c,v 1.2 2010/07/03 08:18:30 jmmv Exp $	*/
2 
3 #include <sys/types.h>
4 #include <sys/ioctl.h>
5 #include <sys/tty.h>
6 
7 #include <atf-c.h>
8 #include <fcntl.h>
9 
10 #include <rump/rump.h>
11 #include <rump/rump_syscalls.h>
12 
13 ATF_TC(ptyioctl);
14 ATF_TC_HEAD(ptyioctl, tc)
15 {
16 
17 	atf_tc_set_md_var(tc, "descr", "ioctl on pty");
18 }
19 
20 ATF_TC_BODY(ptyioctl, tc)
21 {
22 	struct termios tio;
23 	int fd;
24 
25 	rump_init();
26 	fd = rump_sys_open("/dev/ptyp1", O_RDWR);
27 	if (fd == -1)
28 		err(1, "open");
29 
30 	/* boom, dies with null deref under ptcwakeup() */
31 	atf_tc_expect_signal(-1, "PR kern/40688");
32 	rump_sys_ioctl(fd, TIOCGETA, &tio);
33 }
34 
35 ATF_TP_ADD_TCS(tp)
36 {
37 
38 	ATF_TP_ADD_TC(tp, ptyioctl);
39 
40 	return atf_no_error();
41 }
42