xref: /dpdk/lib/eal/linux/include/rte_os.h (revision a3c8a446)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2019 Intel Corporation
3  */
4 
5 #ifndef _RTE_OS_H_
6 #define _RTE_OS_H_
7 
8 /**
9  * This header should contain any definition
10  * which is not supported natively or named differently in Linux.
11  */
12 
13 #include <sched.h>
14 
15 #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */
16 typedef cpu_set_t rte_cpuset_t;
17 #define RTE_HAS_CPUSET
18 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
19 #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
20 #define RTE_CPU_FILL(set) do \
21 { \
22 	unsigned int i; \
23 	CPU_ZERO(set); \
24 	for (i = 0; i < CPU_SETSIZE; i++) \
25 		CPU_SET(i, set); \
26 } while (0)
27 #define RTE_CPU_NOT(dst, src) do \
28 { \
29 	cpu_set_t tmp; \
30 	RTE_CPU_FILL(&tmp); \
31 	CPU_XOR(dst, &tmp, src); \
32 } while (0)
33 #endif
34 
35 #endif /* _RTE_OS_H_ */
36