FreeBSD/contrib/ntp/libntp/ntp_worker.c
/*
 * blocking_child_common runs as a forked child or a thread
 */
blocking_child_common runs as a forked child or a thread
blocking_child_common runs as a forked child or a thread
int
blocking_child_common(
	blocking_child	*c
	)
{
	int say_bye;
	blocking_pipe_header *req;
	say_bye = FALSE;
	while (!say_bye) {
		req = receive_blocking_req_internal(c);
		if (NULL == req) {
			say_bye = TRUE;
			continue;
		}
		DEBUG_REQUIRE(BLOCKING_REQ_MAGIC == req->magic_sig);
		switch (req->rtype) {
		case BLOCKING_GETADDRINFO:
			if (blocking_getaddrinfo(c, req))
				say_bye = TRUE;
			break;
		case BLOCKING_GETNAMEINFO:
			if (blocking_getnameinfo(c, req))
				say_bye = TRUE;
			break;
		default:
			msyslog(LOG_ERR, "unknown req %d to blocking worker", req->rtype);
			say_bye = TRUE;
		}
		free(req);
	}
	return 0;
}
int blocking_child_common ( blocking_child * c ) { int say_bye ; blocking_pipe_header * req ; say_bye = FALSE ; while ( ! say_bye ) { req = receive_blocking_req_internal ( c ) ; if ( NULL == req ) { say_bye = TRUE ; continue ; } DEBUG_REQUIRE ( BLOCKING_REQ_MAGIC == req -> magic_sig ) ; switch ( req -> rtype ) { case BLOCKING_GETADDRINFO : if ( blocking_getaddrinfo ( c , req ) ) say_bye = TRUE ; break ; case BLOCKING_GETNAMEINFO : if ( blocking_getnameinfo ( c , req ) ) say_bye = TRUE ; break ; default : msyslog ( LOG_ERR , " " , req -> rtype ) ; say_bye = TRUE ; } free ( req ) ; } return 0 ; }
blocking_child_common runs as a forked child or a thread
blocking_child_common runs as a forked child or a thread