summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-07 23:45:11 +0000
committerbors <bors@rust-lang.org>2022-03-07 23:45:11 +0000
commit1708299c6b49e9fb7e7c34b9edd37c77e7af003c (patch)
tree190f407af52199b1f391711d27f728d0e0a3acf1
parentd47792a2d2ba63de36c7ad75e0f4ae0e7d4a60b3 (diff)
parent8a729d59f37a941fc8d7d8e558236b864e789d1f (diff)
downloadrust-libc-1708299c6b49e9fb7e7c34b9edd37c77e7af003c.tar.gz
Auto merge of #2711 - devnexen:haiku_build_fix, r=Amanieu
haiku build fixes
-rw-r--r--libc-test/build.rs12
-rw-r--r--src/unix/haiku/mod.rs13
-rw-r--r--src/unix/haiku/native.rs12
3 files changed, 29 insertions, 8 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 0496910ef2..32537dc4f2 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -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,
}
});
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index 3c2846eaf8..d0a835bc1f 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -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;
diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs
index 765dc4e8b3..b25da2b863 100644
--- a/src/unix/haiku/native.rs
+++ b/src/unix/haiku/native.rs
@@ -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)