FreeBSD/sbin/devd/tests/client_test.c
/* Setup and return an open client socket */
Setup and return an open client socket
Setup and return an open client socket
static int
common_setup(int socktype, const char* sockpath) {
	struct sockaddr_un devd_addr;
	int s, error;
	memset(&devd_addr, 0, sizeof(devd_addr));
	devd_addr.sun_family = PF_LOCAL;
	strlcpy(devd_addr.sun_path, sockpath, sizeof(devd_addr.sun_path));
	s = socket(PF_LOCAL, socktype, 0);
	ATF_REQUIRE(s >= 0);
	error = connect(s, (struct sockaddr*)&devd_addr, SUN_LEN(&devd_addr));
	ATF_REQUIRE_EQ(0, error);
	create_two_events();
	return (s);
}
static int common_setup ( int socktype , const char * sockpath ) { struct sockaddr_un devd_addr ; int s , error ; memset ( & devd_addr , 0 , sizeof ( devd_addr ) ) ; devd_addr . sun_family = PF_LOCAL ; strlcpy ( devd_addr . sun_path , sockpath , sizeof ( devd_addr . sun_path ) ) ; s = socket ( PF_LOCAL , socktype , 0 ) ; ATF_REQUIRE ( s >= 0 ) ; error = connect ( s , ( struct sockaddr * ) & devd_addr , SUN_LEN ( & devd_addr ) ) ; ATF_REQUIRE_EQ ( 0 , error ) ; create_two_events ( ) ; return ( s ) ; }
Setup and return an open client socket
Setup and return an open client socket