common/octeontx2: fix memory mapping API usage
[dpdk.git] / lib / librte_eal / windows / include / rte_os.h
index e1e0378..569ed92 100644 (file)
@@ -8,31 +8,30 @@
 /**
  * This is header should contain any function/macro definition
  * which are not supported natively or named differently in the
- * Windows OS. Functions will be added in future releases.
+ * Windows OS. It must not include Windows-specific headers.
  */
 
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include <windows.h>
-#include <basetsd.h>
-#include <pthread.h>
-#include <stdio.h>
-
-/* limits.h replacement */
-#include <stdlib.h>
+/* limits.h replacement, value as in <windows.h> */
 #ifndef PATH_MAX
 #define PATH_MAX _MAX_PATH
 #endif
 
+#define sleep(x) Sleep(1000 * (x))
+
 #define strerror_r(a, b, c) strerror_s(b, c, a)
 
 /* strdup is deprecated in Microsoft libc and _strdup is preferred */
 #define strdup(str) _strdup(str)
 
-typedef SSIZE_T ssize_t;
-
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
 
 #define index(a, b)     strchr(a, b)
@@ -40,24 +39,20 @@ typedef SSIZE_T ssize_t;
 
 #define strncasecmp(s1, s2, count)        _strnicmp(s1, s2, count)
 
-/**
- * Create a thread.
- * This function is private to EAL.
- *
- * @param thread
- *   The location to store the thread id if successful.
- * @return
- *   0 for success, -1 if the thread is not created.
- */
-int eal_thread_create(pthread_t *thread);
+#define close _close
+#define unlink _unlink
 
-/**
- * Create a map of processors and cores on the system.
- * This function is private to EAL.
- */
-void eal_create_cpu_map(void);
+/* cpu_set macros implementation */
+#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
+#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
+#define RTE_CPU_FILL(set) CPU_FILL(set)
+#define RTE_CPU_NOT(dst, src) CPU_NOT(dst, src)
+
+/* as in <windows.h> */
+typedef long long ssize_t;
 
 #ifndef RTE_TOOLCHAIN_GCC
+
 static inline int
 asprintf(char **buffer, const char *format, ...)
 {
@@ -84,13 +79,19 @@ asprintf(char **buffer, const char *format, ...)
        }
        return ret;
 }
-#endif /* RTE_TOOLCHAIN_GCC */
 
-/* cpu_set macros implementation */
-#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
-#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
-#define RTE_CPU_FILL(set) CPU_FILL(set)
-#define RTE_CPU_NOT(dst, src) CPU_NOT(dst, src)
+static inline const char *
+eal_strerror(int code)
+{
+       static char buffer[128];
+
+       strerror_s(buffer, sizeof(buffer), code);
+       return buffer;
+}
+
+#define strerror eal_strerror
+
+#endif /* RTE_TOOLCHAIN_GCC */
 
 #ifdef __cplusplus
 }