src/dpdk/lib/librte_eal/freebsd/eal.c
enum rte_proc_type_t
eal_proc_type_detect(void)
{
	enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
	const char *pathname = eal_runtime_config_path();
	const struct internal_config *internal_conf =
		eal_get_internal_configuration();

	/* if there no shared config, there can be no secondary processes */
	if (!internal_conf->no_shconf) {
		/* if we can open the file but not get a write-lock we are a
		 * secondary process. NOTE: if we get a file handle back, we
		 * keep that open and don't close it to prevent a race condition
		 * between multiple opens.
		 */
		if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
				(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
			ptype = RTE_PROC_SECONDARY;
	}

	RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
			ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");

	return ptype;
}
/* Detect if we are a primary or a secondary process */
Detect if we are a primary or a secondary process
Detect if we are a primary or a secondary process
enum rte_proc_type_t
eal_proc_type_detect(void)
{
	enum rte_proc_type_t ptype = RTE_PROC_PRIMARY;
	const char *pathname = eal_runtime_config_path();
	const struct internal_config *internal_conf =
		eal_get_internal_configuration();
	if (!internal_conf->no_shconf) {
		if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) &&
				(fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0))
			ptype = RTE_PROC_SECONDARY;
	}
	RTE_LOG(INFO, EAL, "Auto-detected process type: %s\n",
			ptype == RTE_PROC_PRIMARY ? "PRIMARY" : "SECONDARY");
	return ptype;
}
enum rte_proc_type_t eal_proc_type_detect ( void ) { enum rte_proc_type_t ptype = RTE_PROC_PRIMARY ; const char * pathname = eal_runtime_config_path ( ) ; const struct internal_config * internal_conf = eal_get_internal_configuration ( ) ; if ( ! internal_conf -> no_shconf ) { if ( ( ( mem_cfg_fd = open ( pathname , O_RDWR ) ) >= 0 ) && ( fcntl ( mem_cfg_fd , F_SETLK , & wr_lock ) < 0 ) ) ptype = RTE_PROC_SECONDARY ; } RTE_LOG ( INFO , EAL , " \n " , ptype == RTE_PROC_PRIMARY ? " " : " " ) ; return ptype ; }
Detect if we are a primary or a secondary process
Detect if we are a primary or a secondary process
/* if there no shared config, there can be no secondary processes */ /* if we can open the file but not get a write-lock we are a
		 * secondary process. NOTE: if we get a file handle back, we
		 * keep that open and don't close it to prevent a race condition
		 * between multiple opens.
		 */