*/
void __rte_thread_uninit(void);
+/**
+ * asprintf(3) replacement for Windows.
+ */
+#ifdef RTE_EXEC_ENV_WINDOWS
+__rte_format_printf(2, 3)
+int eal_asprintf(char **buffer, const char *format, ...);
+
+#define asprintf(buffer, format, ...) \
+ eal_asprintf(buffer, format, ##__VA_ARGS__)
+#endif
+
#endif /* _EAL_PRIVATE_H_ */
* Copyright(c) 2019 Intel Corporation
*/
+#include <stdarg.h>
+
#include <fcntl.h>
#include <io.h>
#include <share.h>
return fctret;
}
+/* Don't use MinGW asprintf() to have identical code with all toolchains. */
+int
+eal_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++;
+
+ *buffer = 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;
+}
+
int
rte_vfio_container_dma_map(__rte_unused int container_fd,
__rte_unused uint64_t vaddr,
* which is not supported natively or named differently in Windows.
*/
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.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++;
-
- *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;
-}
-
static inline const char *
eal_strerror(int code)
{
#ifndef strerror
#define strerror eal_strerror
#endif
-
#endif /* RTE_TOOLCHAIN_GCC */
#ifdef __cplusplus