[BACK]Return to t_pr.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / tests / kernel / tty

File: [cvs.NetBSD.org] / src / tests / kernel / tty / t_pr.c (download)

Revision 1.3, Wed Nov 3 16:10:20 2010 UTC (11 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.2: +2 -3 lines

add Makefile.inc everywhere so that we can set WARNS=4 by default. Amazing
how many bugs this found :-)

/*	$NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:20 christos Exp $	*/

#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/tty.h>

#include <atf-c.h>
#include <fcntl.h>

#include <rump/rump.h>
#include <rump/rump_syscalls.h>

ATF_TC(ptyioctl);
ATF_TC_HEAD(ptyioctl, tc)
{

	atf_tc_set_md_var(tc, "descr", "ioctl on pty");
}

ATF_TC_BODY(ptyioctl, tc)
{
	struct termios tio;
	int fd;

	rump_init();
	fd = rump_sys_open("/dev/ptyp1", O_RDWR);
	ATF_CHECK(fd != -1);

	/* boom, dies with null deref under ptcwakeup() */
	atf_tc_expect_signal(-1, "PR kern/40688");
	rump_sys_ioctl(fd, TIOCGETA, &tio);
}

ATF_TP_ADD_TCS(tp)
{

	ATF_TP_ADD_TC(tp, ptyioctl);

	return atf_no_error();
}