Prefix jemalloc on DragonFly to prevent segfaults.

Similar to commits ed015456a1 (iOS)
and e3b414d861 (Android)
This commit is contained in:
Michael Neumann
2016-04-02 18:40:59 +02:00
parent 235d77457d
commit 9f3de64732
3 changed files with 16 additions and 7 deletions

View File

@@ -42,22 +42,27 @@ use libc::{c_int, c_void, size_t};
extern {}
// Note that the symbols here are prefixed by default on OSX (we don't
// explicitly request it), and on Android we explicitly request it as
// unprefixing cause segfaults (mismatches in allocators).
// explicitly request it), and on Android and DragonFly we explicitly request
// it as unprefixing cause segfaults (mismatches in allocators).
extern {
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
target_os = "dragonfly"),
link_name = "je_mallocx")]
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
target_os = "dragonfly"),
link_name = "je_rallocx")]
fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
target_os = "dragonfly"),
link_name = "je_xallocx")]
fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
target_os = "dragonfly"),
link_name = "je_sdallocx")]
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios"),
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
target_os = "dragonfly"),
link_name = "je_nallocx")]
fn nallocx(size: size_t, flags: c_int) -> size_t;
}