mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Merge pull request #593 from devnexen/fbsd_mprotect
Hunk: FreeBSD set the map permission to max read and write
This commit is contained in:
commit
56ddda7021
1 changed files with 8 additions and 1 deletions
|
@ -59,6 +59,7 @@ Hunk_Begin(int maxsize)
|
|||
maxhunksize = maxsize + sizeof(size_t) + 32;
|
||||
curhunksize = 0;
|
||||
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
int prot = PROT_READ | PROT_WRITE;
|
||||
|
||||
#if defined(MAP_ALIGNED_SUPER)
|
||||
const size_t hgpagesize = 1UL<<21;
|
||||
|
@ -72,7 +73,13 @@ Hunk_Begin(int maxsize)
|
|||
}
|
||||
#endif
|
||||
|
||||
membase = mmap(0, maxhunksize, PROT_READ | PROT_WRITE,
|
||||
#if defined(PROT_MAX)
|
||||
/* For now it is FreeBSD exclusif but could possibly be extended
|
||||
to other like DFBSD for example */
|
||||
prot = PROT_MAX(prot);
|
||||
#endif
|
||||
|
||||
membase = mmap(0, maxhunksize, prot,
|
||||
flags, -1, 0);
|
||||
|
||||
if ((membase == NULL) || (membase == (byte *)-1))
|
||||
|
|
Loading…
Reference in a new issue