@@ -84,6 +84,9 @@ API Changes
Also, make sure to start the actual text at the margin.
=======================================================
+* eal/windows: Removed POSIX symbol export from ``<rte_os.h>``.
+ It has been incorrect and could conflict with consumer POSIX implementations.
+
ABI Changes
-----------
@@ -18,10 +18,6 @@
#include "cmdline_private.h"
-#ifdef RTE_EXEC_ENV_WINDOWS
-#define write _write
-#endif
-
static void
cmdline_valid_buffer(struct rdline *rdl, const char *buf,
__rte_unused unsigned int size)
@@ -16,10 +16,6 @@
#include "cmdline_private.h"
#include "cmdline_socket.h"
-#ifdef RTE_EXEC_ENV_WINDOWS
-#define open _open
-#endif
-
struct cmdline *
cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
{
@@ -15,6 +15,10 @@
#include <rte_errno.h>
#include <rte_string_fns.h>
+#ifdef RTE_EXEC_ENV_WINDOWS
+#define strerror_r(errnum, buf, buflen) strerror_s(buf, buflen, errnum)
+#endif
+
RTE_DEFINE_PER_LCORE(int, _rte_errno);
const char *
@@ -1936,7 +1936,7 @@ eal_check_common_options(struct internal_config *internal_cfg)
RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n");
return -1;
}
- if (index(eal_get_hugefile_prefix(), '%') != NULL) {
+ if (strchr(eal_get_hugefile_prefix(), '%') != NULL) {
RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" "
"option\n");
return -1;
@@ -11,7 +11,6 @@
* Windows OS. It must not include Windows-specific headers.
*/
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -20,100 +19,36 @@
extern "C" {
#endif
-/* limits.h replacement, value as in <windows.h> */
-#ifndef PATH_MAX
-#define PATH_MAX _MAX_PATH
-#endif
-
-#ifndef sleep
-#define sleep(x) Sleep(1000 * (x))
-#endif
-
-#ifndef strerror_r
-#define strerror_r(a, b, c) strerror_s(b, c, a)
-#endif
-
-#ifndef strdup
-/* strdup is deprecated in Microsoft libc and _strdup is preferred */
-#define strdup(str) _strdup(str)
-#endif
-
-#ifndef strtok_r
-#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
-#endif
-
-#ifndef index
-#define index(a, b) strchr(a, b)
-#endif
-
-#ifndef rindex
-#define rindex(a, b) strrchr(a, b)
-#endif
-
-#ifndef strncasecmp
-#define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
-#endif
-
-#ifndef close
-#define close _close
-#endif
-
-#ifndef unlink
-#define unlink _unlink
-#endif
-
/* 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, ...)
-{
- int size, ret;
- va_list arg;
-
- va_start(arg, format);
- size = vsnprintf(NULL, 0, format, arg);
- va_end(arg);
- if (size < 0)
- return -1;
- size++;
+/* Allow DPDK to call common functions by POSIX names. */
+#ifdef RTE_BUILD_INTERNAL
- *buffer = (char *)malloc(size);
- if (*buffer == NULL)
- return -1;
-
- va_start(arg, format);
- ret = vsnprintf(*buffer, size, format, arg);
- va_end(arg);
- if (ret != size - 1) {
- free(*buffer);
- return -1;
- }
- return ret;
-}
+#ifndef PATH_MAX
+#define PATH_MAX _MAX_PATH
+#endif
-static inline const char *
-eal_strerror(int code)
-{
- static char buffer[128];
+#define strdup(str) _strdup(str)
+#define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+#define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
- strerror_s(buffer, sizeof(buffer), code);
- return buffer;
-}
+#define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)
+#define read(fd, buf, n) _read(fd, buf, n)
+#define write(fd, buf, n) _write(fd, buf, n)
+#define close(fd) _close(fd)
+#define unlink(path) _unlink(path)
-#ifndef strerror
-#define strerror eal_strerror
-#endif
+#endif /* RTE_BUILD_INTERNAL */
-#endif /* RTE_TOOLCHAIN_GCC */
+/* This is an exception without "rte_" prefix, because Windows does have
+ * ssize_t, but it's defined in <windows.h> which we avoid to expose.
+ * If ssize_t is defined in user code, it necessarily has the same type.
+ */
+typedef long long ssize_t;
#ifdef __cplusplus
}