#include <stdbool.h>
#include <stdio.h>
-#include <rte_pci.h>
+
#include <rte_bus_pci.h>
+#include <rte_os_shim.h>
+#include <rte_pci.h>
extern struct rte_pci_bus rte_pci_bus;
#ifndef _VDEV_PRIVATE_H_
#define _VDEV_PRIVATE_H_
+#include <rte_os_shim.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#include <rte_kvargs.h>
#include <rte_devargs.h>
#include <rte_bitops.h>
+#include <rte_os_shim.h>
#include "mlx5_prm.h"
#include "mlx5_devx_cmds.h"
#include <rte_tailq.h>
#include <rte_hash_crc.h>
#include <rte_bitmap.h>
+#include <rte_os_shim.h>
#include "i40e_logs.h"
#include "base/i40e_prototype.h"
#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)
#include <io.h>
-#include <rte_os.h>
-
#include "cmdline_private.h"
/* Missing from some MinGW-w64 distributions. */
#include <stdarg.h>
#include <rte_common.h>
+#include <rte_os_shim.h>
#ifdef RTE_EXEC_ENV_WINDOWS
#include <rte_windows.h>
#endif
#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)
{
*/
#include <string.h>
-#include <rte_os.h>
#include <rte_string_fns.h>
#include "eal_private.h"
#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 *
#include <rte_eal.h>
#include <rte_log.h>
+#include <rte_os_shim.h>
#include <rte_per_lcore.h>
#include "eal_log.h"
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;
#define CYC_PER_10MHZ 1E7
RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
" - clock timings may be less accurate.\n");
- /* assume that the sleep(1) will sleep for 1 second */
+ /* assume that the rte_delay_us_sleep() will sleep for 1 second */
uint64_t start = rte_rdtsc();
- sleep(1);
+ rte_delay_us_sleep(US_PER_S);
/* Round up to 10Mhz. 1E7 ~ 10Mhz */
return RTE_ALIGN_MUL_NEAR(rte_rdtsc() - start, CYC_PER_10MHZ);
}
#define EAL_INTERNAL_CFG_H
#include <rte_eal.h>
+#include <rte_os_shim.h>
#include <rte_pci_dev_feature_defs.h>
#include "eal_thread.h"
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#ifndef _RTE_OS_SHIM_
+#define _RTE_OS_SHIM_
+
+#include <rte_os.h>
+
+/**
+ * @file
+ * @internal
+ * Provides semi-standard OS facilities by convenient names.
+ */
+
+#endif /* _RTE_OS_SHIM_ */
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#ifndef _RTE_OS_SHIM_
+#define _RTE_OS_SHIM_
+
+#include <rte_os.h>
+
+/**
+ * @file
+ * @internal
+ * Provides semi-standard OS facilities by convenient names.
+ */
+
+#endif /* _RTE_OS_SHIM_ */
#include <rte_log.h>
#include <rte_memory.h>
#include <rte_memzone.h>
-#include <rte_os.h>
#include "eal_private.h"
#include "eal_filesystem.h"
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_lcore.h>
-#include <rte_os.h>
#include "eal_private.h"
#include "eal_thread.h"
*/
#include <rte_errno.h>
-#include <rte_os.h>
#include "eal_internal_cfg.h"
#include "eal_memalloc.h"
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> */
+/* 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;
-#ifndef RTE_TOOLCHAIN_GCC
-static inline const char *
-eal_strerror(int code)
-{
- static char buffer[128];
-
- strerror_s(buffer, sizeof(buffer), code);
- return buffer;
-}
-
-#ifndef strerror
-#define strerror eal_strerror
-#endif
-#endif /* RTE_TOOLCHAIN_GCC */
-
#ifdef __cplusplus
}
#endif
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#ifndef _RTE_OS_SHIM_
+#define _RTE_OS_SHIM_
+
+#include <rte_os.h>
+
+/**
+ * @file
+ * @internal
+ * Provides semi-standard OS facilities by convenient names.
+ */
+
+#ifndef PATH_MAX
+#define PATH_MAX _MAX_PATH
+#endif
+
+#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)
+
+#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)
+
+#endif /* _RTE_OS_SHIM_ */
#ifndef _ETH_PRIVATE_H_
#define _ETH_PRIVATE_H_
+#include <rte_os_shim.h>
+
#include "rte_ethdev.h"
#ifdef __cplusplus
#include <stdlib.h>
#include <stdbool.h>
+#include <rte_os_shim.h>
#include <rte_string_fns.h>
#include "rte_kvargs.h"