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