Evil: fix mmap() and define HAVE_MMAP

Summary: add size of file mapping to fix invalid parameter

Test Plan: compilation (edje succeeds) and elm_test

Reviewers: zmike, cedric, raster

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9913
This commit is contained in:
Vincent Torri 2019-09-12 10:01:33 -04:00 committed by Mike Blumenkrantz
parent 3307e55874
commit c00d70982f
4 changed files with 17 additions and 3 deletions

View File

@ -144,7 +144,7 @@ struct Dl_info
*/
EAPI void *dlopen(const char* path, int mode);
#ifndef HAVE_DLOPEN
#define HAVE_DLOPEN 1
# define HAVE_DLOPEN 1
#endif
/**
* @brief Close a dynamic-link library.

View File

@ -58,6 +58,8 @@ mmap(void *addr EVIL_UNUSED,
DWORD acs = 0;
HANDLE handle;
void *data;
DWORD low;
DWORD high;
/* get protection */
protect = _evil_mmap_protection_get(prot);
@ -89,7 +91,15 @@ mmap(void *addr EVIL_UNUSED,
}
}
fm = CreateFileMapping(handle, NULL, protect, 0, 0, NULL);
#ifdef _WIN64
low = (DWORD)((len >> 32) & 0x00000000ffffffff);
low = (DWORD)(len & 0x00000000ffffffff);
#else
high = 0L;
low = len;
#endif
fm = CreateFileMapping(handle, NULL, protect, high, low, NULL);
if (!fm)
{
fprintf(stderr, "[Evil] [mmap] CreateFileMapping failed: %s\n",

View File

@ -114,6 +114,10 @@ EAPI void *mmap(void *addr,
int fd,
off_t offset);
#ifndef HAVE_MMAP
# define HAVE_MMAP 1
#endif
/**
* Unmaps a mapped view of a file from the calling process's
* address space.

View File

@ -116,7 +116,7 @@ EAPI int mkstemps(char *__template, int suffixlen);
*/
EAPI char *realpath(const char *file_name, char *resolved_name);
#ifndef HAVE_REALPATH
#define HAVE_REALPATH 1
# define HAVE_REALPATH 1
#endif