Auto merge of #2711 - devnexen:haiku_build_fix, r=Amanieu

haiku build fixes
This commit is contained in:
bors 2022-03-07 23:45:11 +00:00
commit 1708299c6b
3 changed files with 29 additions and 8 deletions

View file

@ -3649,6 +3649,7 @@ fn test_haiku(target: &str) {
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
cfg.define("__USE_GNU", Some("1"));
cfg.define("_GNU_SOURCE", None);
// POSIX API
headers! { cfg:
@ -3751,6 +3752,7 @@ fn test_haiku(target: &str) {
"uchar.h",
"unistd.h",
"utime.h",
"utmpx.h",
"wchar.h",
"wchar_t.h",
"wctype.h"
@ -3758,6 +3760,9 @@ fn test_haiku(target: &str) {
// BSD Extensions
headers! { cfg:
"ifaddrs.h",
"libutil.h",
"link.h",
"pty.h",
}
@ -3803,6 +3808,11 @@ fn test_haiku(target: &str) {
// with mem::zeroed(), so skip the automated test
"image_info" | "thread_info" => true,
"Elf64_Phdr" => true,
// is an union
"cpuid_info" => true,
_ => false,
}
});
@ -3839,6 +3849,8 @@ fn test_haiku(target: &str) {
// translated into a struct argument
"find_path" => true,
"get_cpuid" => true,
_ => false,
}
});

View file

@ -33,14 +33,12 @@ pub type fd_mask = u32;
pub type Elf32_Addr = u32;
pub type Elf32_Half = u16;
pub type Elf32_Lword = u64;
pub type Elf32_Off = u32;
pub type Elf32_Sword = i32;
pub type Elf32_Word = u32;
pub type Elf64_Addr = u64;
pub type Elf64_Half = u16;
pub type Elf64_Lword = u64;
pub type Elf64_Off = u64;
pub type Elf64_Sword = i32;
pub type Elf64_Sxword = i64;
@ -120,12 +118,12 @@ s! {
pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut ::c_char,
pub ifa_name: *const ::c_char,
pub ifa_flags: ::c_uint,
pub ifa_addr: *mut ::sockaddr,
pub ifa_netmask: *mut ::sockaddr,
pub ifa_dstaddr: *mut ::sockaddr,
pub ida_data: *mut ::c_void,
pub ifa_data: *mut ::c_void,
}
pub struct fd_set {
@ -1530,7 +1528,12 @@ extern "C" {
) -> ::c_int;
pub fn getspent() -> *mut spwd;
pub fn getspent_r(pwd: *mut spwd, buf: *mut ::c_char, bufferSize: ::size_t) -> ::c_int;
pub fn getspent_r(
pwd: *mut spwd,
buf: *mut ::c_char,
bufferSize: ::size_t,
res: *mut *mut spwd,
) -> ::c_int;
pub fn setspent();
pub fn endspent();
pub fn getspnam(name: *const ::c_char) -> *mut spwd;

View file

@ -879,7 +879,7 @@ extern "C" {
pub fn rename_thread(thread: thread_id, newName: *const ::c_char) -> status_t;
pub fn set_thread_priority(thread: thread_id, newPriority: i32) -> status_t;
pub fn suggest_thread_priority(
task_flags: be_task_flags,
what: u32,
period: i32,
jitter: ::bigtime_t,
length: ::bigtime_t,
@ -936,8 +936,6 @@ extern "C" {
pub fn debugger(message: *const ::c_char);
pub fn disable_debugger(state: ::c_int) -> ::c_int;
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
pub fn get_system_info(info: *mut system_info) -> status_t;
pub fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t;
pub fn is_computer_on() -> i32;
@ -1084,6 +1082,14 @@ extern "C" {
) -> status_t;
}
cfg_if! {
if #[cfg(libc_union)] {
extern "C" {
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
}
}
}
// The following functions are defined as macros in C/C++
pub unsafe fn get_area_info(id: area_id, info: *mut area_info) -> status_t {
_get_area_info(id, info, core::mem::size_of::<area_info>() as usize)