FreeBSD/sbin/devd/tests/client_test.c
/*
 * Create two devd events.  The easiest way I know of, that requires no special
 * hardware, is to create md(4) devices.
 */
Create two devd events.  The easiest way I know of, that requires no special
hardware, is to create md(4) devices.
Create two devd events . The easiest way I know of that requires no special hardware is to create md ( 4 ) devices .
static void
create_two_events(void)
{
	FILE *create_stdout;
	FILE *destroy_stdout;
	char mdname[80];
	char destroy_cmd[80];
	char *error;
	create_stdout = popen("mdconfig -a -s 64 -t null", "r");
	ATF_REQUIRE(create_stdout != NULL);
	error = fgets(mdname, sizeof(mdname), create_stdout);
	ATF_REQUIRE(error != NULL);
	ATF_REQUIRE_EQ(0, pclose(create_stdout));
	snprintf(destroy_cmd, nitems(destroy_cmd), "mdconfig -d -u %s", mdname);
	destroy_stdout = popen(destroy_cmd, "r");
	ATF_REQUIRE(destroy_stdout != NULL);
	ATF_REQUIRE_EQ(0, pclose(destroy_stdout));
}
static void create_two_events ( void ) { FILE * create_stdout ; FILE * destroy_stdout ; char mdname [ 80 ] ; char destroy_cmd [ 80 ] ; char * error ; create_stdout = popen ( " " , " " ) ; ATF_REQUIRE ( create_stdout != NULL ) ; error = fgets ( mdname , sizeof ( mdname ) , create_stdout ) ; ATF_REQUIRE ( error != NULL ) ; ATF_REQUIRE_EQ ( 0 , pclose ( create_stdout ) ) ; snprintf ( destroy_cmd , nitems ( destroy_cmd ) , " " , mdname ) ; destroy_stdout = popen ( destroy_cmd , " " ) ; ATF_REQUIRE ( destroy_stdout != NULL ) ; ATF_REQUIRE_EQ ( 0 , pclose ( destroy_stdout ) ) ; }
Create two devd events.
Create two devd events .
/* We only expect one line of output */ /* We expect no output */