@@ -18,7 +18,7 @@ static struct rte_config rte_config = {
};
/* platform-specific runtime dir */
-static char runtime_dir[PATH_MAX];
+static char runtime_dir[RTE_PATH_MAX];
/* internal configuration */
static struct internal_config internal_config;
@@ -83,7 +83,7 @@ get_used_mask(void *data, unsigned int elt_sz, unsigned int len)
static int
resize_and_map(int fd, void *addr, size_t len)
{
- char path[PATH_MAX];
+ char path[RTE_PATH_MAX];
void *map_addr;
if (eal_file_truncate(fd, len)) {
@@ -710,7 +710,7 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
unsigned int elt_sz)
{
size_t page_sz, mmap_len;
- char path[PATH_MAX];
+ char path[RTE_PATH_MAX];
struct used_mask *msk;
struct mem_area *ma = NULL;
void *data = NULL;
@@ -836,7 +836,7 @@ rte_fbarray_attach(struct rte_fbarray *arr)
{
struct mem_area *ma = NULL, *tmp = NULL;
size_t page_sz, mmap_len;
- char path[PATH_MAX];
+ char path[RTE_PATH_MAX];
void *data = NULL;
int fd = -1;
@@ -978,7 +978,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
struct mem_area *tmp = NULL;
size_t mmap_len;
int fd, ret;
- char path[PATH_MAX];
+ char path[RTE_PATH_MAX];
const struct internal_config *internal_conf =
eal_get_internal_configuration();
@@ -120,7 +120,7 @@ TAILQ_HEAD(shared_driver_list, shared_driver);
struct shared_driver {
TAILQ_ENTRY(shared_driver) next;
- char name[PATH_MAX];
+ char name[RTE_PATH_MAX];
void* lib_handle;
};
@@ -367,7 +367,7 @@ eal_plugin_add(const char *path)
return -1;
}
memset(solib, 0, sizeof(*solib));
- strlcpy(solib->name, path, PATH_MAX);
+ strlcpy(solib->name, path, RTE_PATH_MAX);
TAILQ_INSERT_TAIL(&solib_list, solib, next);
return 0;
@@ -386,7 +386,7 @@ eal_plugindir_init(const char *path)
{
DIR *d = NULL;
struct dirent *dent = NULL;
- char sopath[PATH_MAX];
+ char sopath[RTE_PATH_MAX];
if (path == NULL || *path == '\0')
return 0;
@@ -430,16 +430,16 @@ verify_perms(const char *dirpath)
/* if not root, check down one level first */
if (strcmp(dirpath, "/") != 0) {
- static __thread char last_dir_checked[PATH_MAX];
- char copy[PATH_MAX];
+ static __thread char last_dir_checked[RTE_PATH_MAX];
+ char copy[RTE_PATH_MAX];
const char *dir;
- strlcpy(copy, dirpath, PATH_MAX);
+ strlcpy(copy, dirpath, RTE_PATH_MAX);
dir = dirname(copy);
- if (strncmp(dir, last_dir_checked, PATH_MAX) != 0) {
+ if (strncmp(dir, last_dir_checked, RTE_PATH_MAX) != 0) {
if (verify_perms(dir) != 0)
return -1;
- strlcpy(last_dir_checked, dir, PATH_MAX);
+ strlcpy(last_dir_checked, dir, RTE_PATH_MAX);
}
}
@@ -477,8 +477,8 @@ eal_dlopen(const char *pathname)
pathname, strerror(errno));
goto out;
}
- if (strnlen(realp, PATH_MAX) == PATH_MAX) {
- RTE_LOG(ERR, EAL, "Error, driver path greater than PATH_MAX\n");
+ if (strnlen(realp, RTE_PATH_MAX) == RTE_PATH_MAX) {
+ RTE_LOG(ERR, EAL, "Error, driver path greater than RTE_PATH_MAX\n");
goto out;
}
@@ -369,11 +369,11 @@ trace_mkdir(void)
static int
trace_meta_save(struct trace *trace)
{
- char file_name[PATH_MAX];
+ char file_name[RTE_PATH_MAX];
FILE *f;
int rc;
- rc = snprintf(file_name, PATH_MAX, "%s/metadata", trace->dir);
+ rc = snprintf(file_name, RTE_PATH_MAX, "%s/metadata", trace->dir);
if (rc < 0)
return rc;
@@ -400,11 +400,12 @@ static int
trace_mem_save(struct trace *trace, struct __rte_trace_header *hdr,
uint32_t cnt)
{
- char file_name[PATH_MAX];
+ char file_name[RTE_PATH_MAX];
FILE *f;
int rc;
- rc = snprintf(file_name, PATH_MAX, "%s/channel0_%d", trace->dir, cnt);
+ rc = snprintf(file_name, RTE_PATH_MAX, "%s/channel0_%d",
+ trace->dir, cnt);
if (rc < 0)
return rc;
@@ -36,7 +36,7 @@ eal_get_hugefile_prefix(void);
static inline const char *
eal_runtime_config_path(void)
{
- static char buffer[PATH_MAX]; /* static so auto-zeroed */
+ static char buffer[RTE_PATH_MAX]; /* static so auto-zeroed */
snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(),
RUNTIME_CONFIG_FNAME);
@@ -48,7 +48,7 @@ eal_runtime_config_path(void)
static inline const char *
eal_mp_socket_path(void)
{
- static char buffer[PATH_MAX]; /* static so auto-zeroed */
+ static char buffer[RTE_PATH_MAX]; /* static so auto-zeroed */
snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(),
MP_SOCKET_FNAME);
@@ -68,7 +68,7 @@ eal_get_fbarray_path(char *buffer, size_t buflen, const char *name) {
static inline const char *
eal_hugepage_info_path(void)
{
- static char buffer[PATH_MAX]; /* static so auto-zeroed */
+ static char buffer[RTE_PATH_MAX]; /* static so auto-zeroed */
snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(),
HUGEPAGE_INFO_FNAME);
@@ -80,7 +80,7 @@ eal_hugepage_info_path(void)
static inline const char *
eal_hugepage_data_path(void)
{
- static char buffer[PATH_MAX]; /* static so auto-zeroed */
+ static char buffer[RTE_PATH_MAX]; /* static so auto-zeroed */
snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(),
HUGEPAGE_DATA_FNAME);
@@ -9,7 +9,7 @@
#include <stdint.h>
#include <limits.h>
-#define MAX_HUGEPAGE_PATH PATH_MAX
+#define MAX_HUGEPAGE_PATH RTE_PATH_MAX
/**
* Structure used to store information about hugepages that we mapped
@@ -27,7 +27,7 @@
*/
struct hugepage_info {
uint64_t hugepage_sz; /**< size of a huge page */
- char hugedir[PATH_MAX]; /**< dir where hugetlbfs is mounted */
+ char hugedir[RTE_PATH_MAX]; /**< dir where hugetlbfs is mounted */
uint32_t num_pages[RTE_MAX_NUMA_NODES];
/**< number of hugepages of that size on each socket */
int lock_descriptor; /**< file descriptor for hugepage dir */
@@ -51,7 +51,7 @@ struct trace_arg {
};
struct trace {
- char dir[PATH_MAX];
+ char dir[RTE_PATH_MAX];
int dir_offset;
int register_errno;
bool status;
@@ -13,6 +13,8 @@
#include <pthread_np.h>
+#define RTE_PATH_MAX PATH_MAX
+
typedef cpuset_t rte_cpuset_t;
#define RTE_CPU_AND(dst, src1, src2) do \
{ \
@@ -13,6 +13,8 @@
#include <sched.h>
+#define RTE_PATH_MAX PATH_MAX
+
typedef cpu_set_t rte_cpuset_t;
#define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
#define RTE_CPU_OR(dst, src1, src2) CPU_OR(dst, src1, src2)
@@ -28,11 +28,6 @@
#include <sys/stat.h>
#include <errno.h>
-/* Maximum length of file name */
-#if !defined(PATH_MAX)
-# define PATH_MAX MAX_PATH
-#endif
-
/* File type flags for d_type */
#define DT_UNKNOWN 0
#define DT_REG S_IFREG
@@ -67,7 +62,7 @@ struct _wdirent {
int d_type;
/* File name */
- wchar_t d_name[PATH_MAX];
+ wchar_t d_name[RTE_PATH_MAX];
};
typedef struct _wdirent _wdirent;
@@ -113,7 +108,7 @@ struct dirent {
int d_type;
/* File name */
- char d_name[PATH_MAX];
+ char d_name[RTE_PATH_MAX];
};
typedef struct dirent dirent;
@@ -388,12 +383,12 @@ opendir(const char *dirname)
/* Allocate memory for DIR structure */
dirp = (DIR *)malloc(sizeof(struct DIR));
if (dirp) {
- wchar_t wname[PATH_MAX];
+ wchar_t wname[RTE_PATH_MAX];
size_t n;
/* Convert directory name to wide-character string */
- error = dirent_mbstowcs_s(&n, wname, PATH_MAX,
- dirname, PATH_MAX);
+ error = dirent_mbstowcs_s(&n, wname, RTE_PATH_MAX,
+ dirname, RTE_PATH_MAX);
if (!error) {
/* Open directory stream using wide-character name */
@@ -457,7 +452,7 @@ readdir(DIR *dirp)
/* Attempt to convert file name to multi-byte string */
error = dirent_wcstombs_s(&n, dirp->ent.d_name,
- PATH_MAX, datap->cFileName, PATH_MAX);
+ RTE_PATH_MAX, datap->cFileName, RTE_PATH_MAX);
/*
* If the file name cannot be represented by a multi-byte
@@ -472,8 +467,8 @@ readdir(DIR *dirp)
*/
if (error && datap->cAlternateFileName[0] != '\0') {
error = dirent_wcstombs_s(
- &n, dirp->ent.d_name, PATH_MAX,
- datap->cAlternateFileName, PATH_MAX);
+ &n, dirp->ent.d_name, RTE_PATH_MAX,
+ datap->cAlternateFileName, RTE_PATH_MAX);
}
if (!error) {
@@ -20,6 +20,8 @@
extern "C" {
#endif
+#define RTE_PATH_MAX _MAX_PATH
+
/* limits.h replacement, value as in <windows.h> */
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH