pci: build on Windows
authorTal Shnaiderman <talshn@mellanox.com>
Mon, 29 Jun 2020 12:37:35 +0000 (15:37 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 29 Jun 2020 22:02:54 +0000 (00:02 +0200)
Added <sys/types.h> in rte_pci header file
to include off_t type since it is missing for Windows.

Define the implementation of the Linux function rte_pci_get_sysfs_path
in pci_common.c for Linux OS only as it is unneeded for other OSs
and to avoid the warning on deprecated call to getenv() on Windows:

"warning: 'getenv' is deprecated: This function or variable may be unsafe.
Consider using _dupenv_s instead."

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
drivers/bus/pci/pci_common.c
lib/librte_eal/rte_eal_exports.def
lib/librte_pci/rte_pci.h
lib/meson.build

index 245d94f..ed69ec2 100644 (file)
@@ -35,9 +35,11 @@ const char *rte_pci_get_sysfs_path(void)
 {
        const char *path = NULL;
 
+#ifdef RTE_EXEC_ENV_LINUX
        path = getenv("SYSFS_PCI_DEVICES");
        if (path == NULL)
                return SYSFS_PCI_DEVICES;
+#endif
 
        return path;
 }
index 7f0c8f5..61bcb8a 100644 (file)
@@ -1,5 +1,6 @@
 EXPORTS
        __rte_panic
+       per_lcore__rte_errno
        rte_calloc
        rte_calloc_socket
        rte_eal_get_configuration
index b721bbf..9337079 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
 #include <limits.h>
 #include <sys/queue.h>
 #include <inttypes.h>
+#include <sys/types.h>
 
 /** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
 #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
index cbcb985..af66610 100644 (file)
@@ -36,7 +36,10 @@ libraries = [
        'flow_classify', 'bpf', 'graph', 'node']
 
 if is_windows
-       libraries = ['kvargs','eal'] # only supported libraries for windows
+       libraries = [
+               'kvargs','eal',
+               'pci',
+       ] # only supported libraries for windows
 endif
 
 default_cflags = machine_args