}
static int
-resize_and_map(int fd, void *addr, size_t len)
+resize_and_map(int fd, const char *path, void *addr, size_t len)
{
- char path[PATH_MAX];
void *map_addr;
if (eal_file_truncate(fd, len)) {
if (start >= ma_start && start < ma_end)
return 1;
/* end overlap? */
- if (end >= ma_start && end < ma_end)
+ if (end > ma_start && end < ma_end)
return 1;
return 0;
}
struct mem_area *ma = NULL;
void *data = NULL;
int fd = -1;
+ const struct internal_config *internal_conf =
+ eal_get_internal_configuration();
if (arr == NULL) {
rte_errno = EINVAL;
fd = -1;
- if (internal_config.no_shconf) {
+ if (internal_conf->no_shconf) {
/* remap virtual area as writable */
static const int flags = RTE_MAP_FORCE_ADDRESS |
RTE_MAP_PRIVATE | RTE_MAP_ANONYMOUS;
if (eal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN))
goto fail;
- if (resize_and_map(fd, data, mmap_len))
+ if (resize_and_map(fd, path, data, mmap_len))
goto fail;
}
ma->addr = data;
if (eal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN))
goto fail;
- if (resize_and_map(fd, data, mmap_len))
+ if (resize_and_map(fd, path, data, mmap_len))
goto fail;
/* store our new memory area */
size_t mmap_len;
int fd, ret;
char path[PATH_MAX];
+ const struct internal_config *internal_conf =
+ eal_get_internal_configuration();
if (arr == NULL) {
rte_errno = EINVAL;
goto out;
}
/* with no shconf, there were never any files to begin with */
- if (!internal_config.no_shconf) {
+ if (!internal_conf->no_shconf) {
/*
* attempt to get an exclusive lock on the file, to ensure it
* has been detached by all other processes