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