Skip to content

Commit 1708299

Browse files
committed
Auto merge of #2711 - devnexen:haiku_build_fix, r=Amanieu
haiku build fixes
2 parents d47792a + 8a729d5 commit 1708299

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

libc-test/build.rs

+12
Original file line numberDiff line numberDiff line change
@@ -3649,6 +3649,7 @@ fn test_haiku(target: &str) {
36493649
let mut cfg = ctest_cfg();
36503650
cfg.flag("-Wno-deprecated-declarations");
36513651
cfg.define("__USE_GNU", Some("1"));
3652+
cfg.define("_GNU_SOURCE", None);
36523653

36533654
// POSIX API
36543655
headers! { cfg:
@@ -3751,13 +3752,17 @@ fn test_haiku(target: &str) {
37513752
"uchar.h",
37523753
"unistd.h",
37533754
"utime.h",
3755+
"utmpx.h",
37543756
"wchar.h",
37553757
"wchar_t.h",
37563758
"wctype.h"
37573759
}
37583760

37593761
// BSD Extensions
37603762
headers! { cfg:
3763+
"ifaddrs.h",
3764+
"libutil.h",
3765+
"link.h",
37613766
"pty.h",
37623767
}
37633768

@@ -3803,6 +3808,11 @@ fn test_haiku(target: &str) {
38033808
// with mem::zeroed(), so skip the automated test
38043809
"image_info" | "thread_info" => true,
38053810

3811+
"Elf64_Phdr" => true,
3812+
3813+
// is an union
3814+
"cpuid_info" => true,
3815+
38063816
_ => false,
38073817
}
38083818
});
@@ -3839,6 +3849,8 @@ fn test_haiku(target: &str) {
38393849
// translated into a struct argument
38403850
"find_path" => true,
38413851

3852+
"get_cpuid" => true,
3853+
38423854
_ => false,
38433855
}
38443856
});

src/unix/haiku/mod.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ pub type fd_mask = u32;
3333

3434
pub type Elf32_Addr = u32;
3535
pub type Elf32_Half = u16;
36-
pub type Elf32_Lword = u64;
3736
pub type Elf32_Off = u32;
3837
pub type Elf32_Sword = i32;
3938
pub type Elf32_Word = u32;
4039

4140
pub type Elf64_Addr = u64;
4241
pub type Elf64_Half = u16;
43-
pub type Elf64_Lword = u64;
4442
pub type Elf64_Off = u64;
4543
pub type Elf64_Sword = i32;
4644
pub type Elf64_Sxword = i64;
@@ -120,12 +118,12 @@ s! {
120118

121119
pub struct ifaddrs {
122120
pub ifa_next: *mut ifaddrs,
123-
pub ifa_name: *mut ::c_char,
121+
pub ifa_name: *const ::c_char,
124122
pub ifa_flags: ::c_uint,
125123
pub ifa_addr: *mut ::sockaddr,
126124
pub ifa_netmask: *mut ::sockaddr,
127125
pub ifa_dstaddr: *mut ::sockaddr,
128-
pub ida_data: *mut ::c_void,
126+
pub ifa_data: *mut ::c_void,
129127
}
130128

131129
pub struct fd_set {
@@ -1530,7 +1528,12 @@ extern "C" {
15301528
) -> ::c_int;
15311529

15321530
pub fn getspent() -> *mut spwd;
1533-
pub fn getspent_r(pwd: *mut spwd, buf: *mut ::c_char, bufferSize: ::size_t) -> ::c_int;
1531+
pub fn getspent_r(
1532+
pwd: *mut spwd,
1533+
buf: *mut ::c_char,
1534+
bufferSize: ::size_t,
1535+
res: *mut *mut spwd,
1536+
) -> ::c_int;
15341537
pub fn setspent();
15351538
pub fn endspent();
15361539
pub fn getspnam(name: *const ::c_char) -> *mut spwd;

src/unix/haiku/native.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ extern "C" {
879879
pub fn rename_thread(thread: thread_id, newName: *const ::c_char) -> status_t;
880880
pub fn set_thread_priority(thread: thread_id, newPriority: i32) -> status_t;
881881
pub fn suggest_thread_priority(
882-
task_flags: be_task_flags,
882+
what: u32,
883883
period: i32,
884884
jitter: ::bigtime_t,
885885
length: ::bigtime_t,
@@ -936,8 +936,6 @@ extern "C" {
936936
pub fn debugger(message: *const ::c_char);
937937
pub fn disable_debugger(state: ::c_int) -> ::c_int;
938938

939-
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
940-
941939
pub fn get_system_info(info: *mut system_info) -> status_t;
942940
pub fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t;
943941
pub fn is_computer_on() -> i32;
@@ -1084,6 +1082,14 @@ extern "C" {
10841082
) -> status_t;
10851083
}
10861084

1085+
cfg_if! {
1086+
if #[cfg(libc_union)] {
1087+
extern "C" {
1088+
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
1089+
}
1090+
}
1091+
}
1092+
10871093
// The following functions are defined as macros in C/C++
10881094
pub unsafe fn get_area_info(id: area_id, info: *mut area_info) -> status_t {
10891095
_get_area_info(id, info, core::mem::size_of::<area_info>() as usize)

0 commit comments

Comments
 (0)