add FreeBSD + DragonFlyBSD MAP_STACK workaround
http://lists.freebsd.org/pipermail/freebsd-bugs/2011-July/044840.html according to libgreen, DragonFlyBSD suffers from this too
This commit is contained in:
parent
68f70fb1c9
commit
af7e9ea67c
|
@ -20,9 +20,15 @@ pub fn sys_page_size() -> usize {
|
||||||
const GUARD_PROT: c_int = libc::PROT_NONE;
|
const GUARD_PROT: c_int = libc::PROT_NONE;
|
||||||
const STACK_PROT: c_int = libc::PROT_READ
|
const STACK_PROT: c_int = libc::PROT_READ
|
||||||
| libc::PROT_WRITE;
|
| libc::PROT_WRITE;
|
||||||
|
#[cfg(not(any(target_os = "freebsd", target_os = "dragonfly")))]
|
||||||
const STACK_FLAGS: c_int = libc::MAP_STACK
|
const STACK_FLAGS: c_int = libc::MAP_STACK
|
||||||
| libc::MAP_PRIVATE
|
| libc::MAP_PRIVATE
|
||||||
| libc::MAP_ANON;
|
| libc::MAP_ANON;
|
||||||
|
// workaround for http://lists.freebsd.org/pipermail/freebsd-bugs/2011-July/044840.html
|
||||||
|
// according to libgreen, DragonFlyBSD suffers from this too
|
||||||
|
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
||||||
|
const STACK_FLAGS: c_int = libc::MAP_PRIVATE
|
||||||
|
| libc::MAP_ANON;
|
||||||
|
|
||||||
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
|
pub unsafe fn map_stack(len: usize) -> Option<*mut u8> {
|
||||||
let ptr = mmap(ptr::null_mut(), len as size_t,
|
let ptr = mmap(ptr::null_mut(), len as size_t,
|
||||||
|
|
Loading…
Reference in New Issue