xref: /dpdk/lib/eal/windows/include/rte_os.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
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 Windows.
11  */
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <string.h>
16 
17 #include <sched.h>
18 
19 /* These macros are compatible with bundled sys/queue.h. */
20 #define RTE_TAILQ_HEAD(name, type) \
21 struct name { \
22 	struct type *tqh_first; \
23 	struct type **tqh_last; \
24 }
25 #define RTE_TAILQ_ENTRY(type) \
26 struct { \
27 	struct type *tqe_next; \
28 	struct type **tqe_prev; \
29 }
30 #define RTE_TAILQ_FOREACH(var, head, field) \
31 	for ((var) = RTE_TAILQ_FIRST((head)); \
32 	    (var); \
33 	    (var) = RTE_TAILQ_NEXT((var), field))
34 #define RTE_TAILQ_FIRST(head) ((head)->tqh_first)
35 #define RTE_TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
36 #define RTE_STAILQ_HEAD(name, type) \
37 struct name { \
38 	struct type *stqh_first; \
39 	struct type **stqh_last; \
40 }
41 #define RTE_STAILQ_ENTRY(type) \
42 struct { \
43 	struct type *stqe_next; \
44 }
45 
46 /* cpu_set macros implementation */
47 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
48 #define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
49 #define RTE_CPU_FILL(set) CPU_FILL(set)
50 #define RTE_CPU_NOT(dst, src) CPU_NOT(dst, src)
51 
52 /* This is an exception without "rte_" prefix, because Windows does have
53  * ssize_t, but it's defined in <windows.h> which we avoid to expose.
54  * If ssize_t is defined in user code, it necessarily has the same type.
55  */
56 typedef long long ssize_t;
57 
58 #endif /* _RTE_OS_H_ */
59