src/dpdk/lib/librte_eal/common/malloc_mp.c
static int
handle_sync(const struct rte_mp_msg *msg, const void *peer)
{
	struct rte_mp_msg reply;
	const struct malloc_mp_req *req =
			(const struct malloc_mp_req *)msg->param;
	struct malloc_mp_req *resp =
			(struct malloc_mp_req *)reply.param;
	int ret;

	if (req->t != REQ_TYPE_SYNC) {
		RTE_LOG(ERR, EAL, "Unexpected request from primary\n");
		return -1;
	}

	memset(&reply, 0, sizeof(reply));

	reply.num_fds = 0;
	strlcpy(reply.name, msg->name, sizeof(reply.name));
	reply.len_param = sizeof(*resp);

	ret = eal_memalloc_sync_with_primary();

	resp->t = REQ_TYPE_SYNC;
	resp->id = req->id;
	resp->result = ret == 0 ? REQ_RESULT_SUCCESS : REQ_RESULT_FAIL;

	rte_mp_reply(&reply, peer);

	return 0;
}
/* secondary will respond to sync requests thusly */
secondary will respond to sync requests thusly
secondary will respond to sync requests thusly
static int
handle_sync(const struct rte_mp_msg *msg, const void *peer)
{
	struct rte_mp_msg reply;
	const struct malloc_mp_req *req =
			(const struct malloc_mp_req *)msg->param;
	struct malloc_mp_req *resp =
			(struct malloc_mp_req *)reply.param;
	int ret;
	if (req->t != REQ_TYPE_SYNC) {
		RTE_LOG(ERR, EAL, "Unexpected request from primary\n");
		return -1;
	}
	memset(&reply, 0, sizeof(reply));
	reply.num_fds = 0;
	strlcpy(reply.name, msg->name, sizeof(reply.name));
	reply.len_param = sizeof(*resp);
	ret = eal_memalloc_sync_with_primary();
	resp->t = REQ_TYPE_SYNC;
	resp->id = req->id;
	resp->result = ret == 0 ? REQ_RESULT_SUCCESS : REQ_RESULT_FAIL;
	rte_mp_reply(&reply, peer);
	return 0;
}
static int handle_sync ( const struct rte_mp_msg * msg , const void * peer ) { struct rte_mp_msg reply ; const struct malloc_mp_req * req = ( const struct malloc_mp_req * ) msg -> param ; struct malloc_mp_req * resp = ( struct malloc_mp_req * ) reply . param ; int ret ; if ( req -> t != REQ_TYPE_SYNC ) { RTE_LOG ( ERR , EAL , " \n " ) ; return -1 ; } memset ( & reply , 0 , sizeof ( reply ) ) ; reply . num_fds = 0 ; strlcpy ( reply . name , msg -> name , sizeof ( reply . name ) ) ; reply . len_param = sizeof ( * resp ) ; ret = eal_memalloc_sync_with_primary ( ) ; resp -> t = REQ_TYPE_SYNC ; resp -> id = req -> id ; resp -> result = ret == 0 ? REQ_RESULT_SUCCESS : REQ_RESULT_FAIL ; rte_mp_reply ( & reply , peer ) ; return 0 ; }
secondary will respond to sync requests thusly
secondary will respond to sync requests thusly