Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_mmap.c
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | #endif | ||||
* FreeBSD is free to ignore the address hint if MAP_FIXED wasn't | * FreeBSD is free to ignore the address hint if MAP_FIXED wasn't | ||||
* passed. However, some Linux applications, like the ART runtime, | * passed. However, some Linux applications, like the ART runtime, | ||||
* depend on the hint. If the MAP_FIXED wasn't passed, but the | * depend on the hint. If the MAP_FIXED wasn't passed, but the | ||||
* address is not zero, try with MAP_FIXED and MAP_EXCL first, | * address is not zero, try with MAP_FIXED and MAP_EXCL first, | ||||
* and fall back to the normal behaviour if that fails. | * and fall back to the normal behaviour if that fails. | ||||
*/ | */ | ||||
if (addr != 0 && (bsd_flags & MAP_FIXED) == 0 && | if (addr != 0 && (bsd_flags & MAP_FIXED) == 0 && | ||||
(bsd_flags & MAP_EXCL) == 0) { | (bsd_flags & MAP_EXCL) == 0) { | ||||
error = kern_mmap(td, addr, len, prot, | error = kern_mmap(td, addr, len, PROT_MAX(PROT_ALL) | prot, | ||||
bsd_flags | MAP_FIXED | MAP_EXCL, fd, pos); | bsd_flags | MAP_FIXED | MAP_EXCL, fd, pos); | ||||
if (error == 0) | if (error == 0) | ||||
goto out; | goto out; | ||||
} | } | ||||
error = kern_mmap(td, addr, len, prot, bsd_flags, fd, pos); | error = kern_mmap(td, addr, len, PROT_MAX(PROT_ALL) | prot, bsd_flags, | ||||
fd, pos); | |||||
out: | out: | ||||
LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); | LINUX_CTR2(mmap2, "return: %d (%p)", error, td->td_retval[0]); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot) | linux_mprotect_common(struct thread *td, uintptr_t addr, size_t len, int prot) | ||||
Show All 22 Lines |