summaryrefslogtreecommitdiff
path: root/src/unix/haiku/native.rs
diff options
context:
space:
mode:
authorJessica Hamilton <jessica.l.hamilton@gmail.com>2022-04-18 13:00:38 +1200
committerJessica Hamilton <jessica.l.hamilton@gmail.com>2022-04-29 09:04:10 +1200
commita7cba7c34059f8f9fab8afaaf405590dd8a2bb82 (patch)
tree199a110f3f46234f067feb41ebb75b89e3614a84 /src/unix/haiku/native.rs
parentdff5aca2a10d886b13b66b92b959e769b74a0fb7 (diff)
downloadrust-libc-a7cba7c34059f8f9fab8afaaf405590dd8a2bb82.tar.gz
haiku: improve platform compatibility
* Also moves a number functions out of the `libbsd` module, as these are actually in `libroot`, so don't require linking against `libbsd`. * `dl_iterate_phdr` is not implemented. * `B_FILE_NOT_FOUND` has been deprecated, and removed from the public headers
Diffstat (limited to 'src/unix/haiku/native.rs')
-rw-r--r--src/unix/haiku/native.rs36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs
index cf06094c43..44bcc1e3b7 100644
--- a/src/unix/haiku/native.rs
+++ b/src/unix/haiku/native.rs
@@ -272,7 +272,8 @@ s! {
pub struct cpu_info {
pub active_time: bigtime_t,
- pub enabled: bool
+ pub enabled: bool,
+ pub current_frequency: u64
}
pub struct system_info {
@@ -667,7 +668,6 @@ pub const B_SHUTTING_DOWN: status_t = B_APP_ERROR_BASE + 18;
// Storage kit errors
pub const B_FILE_ERROR: status_t = B_STORAGE_ERROR_BASE + 0;
-pub const B_FILE_NOT_FOUND: status_t = B_STORAGE_ERROR_BASE + 1;
pub const B_FILE_EXISTS: status_t = B_STORAGE_ERROR_BASE + 2;
pub const B_ENTRY_NOT_FOUND: status_t = B_STORAGE_ERROR_BASE + 3;
pub const B_NAME_TOO_LONG: status_t = B_STORAGE_ERROR_BASE + 4;
@@ -1020,7 +1020,12 @@ extern "C" {
pub fn disable_debugger(state: ::c_int) -> ::c_int;
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 _get_cpu_info_etc(
+ firstCPU: u32,
+ cpuCount: u32,
+ info: *mut cpu_info,
+ size: ::size_t,
+ ) -> status_t;
pub fn is_computer_on() -> i32;
pub fn is_computer_on_fire() -> ::c_double;
pub fn send_signal(threadID: thread_id, signal: ::c_uint) -> ::c_int;
@@ -1200,6 +1205,7 @@ extern "C" {
architecture: *const ::c_char,
baseDirectory: path_base_directory,
subPath: *const ::c_char,
+ flags: u32,
_paths: *mut *mut *mut ::c_char,
pathCount: *mut ::size_t,
) -> status_t;
@@ -1221,10 +1227,22 @@ cfg_if! {
}
// The following functions are defined as macros in C/C++
+#[inline]
+pub unsafe fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t {
+ _get_cpu_info_etc(
+ firstCPU,
+ cpuCount,
+ info,
+ core::mem::size_of::<cpu_info>() as ::size_t,
+ )
+}
+
+#[inline]
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)
}
+#[inline]
pub unsafe fn get_next_area_info(
team: team_id,
cookie: *mut isize,
@@ -1238,10 +1256,12 @@ pub unsafe fn get_next_area_info(
)
}
+#[inline]
pub unsafe fn get_port_info(port: port_id, buf: *mut port_info) -> status_t {
_get_port_info(port, buf, core::mem::size_of::<port_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_next_port_info(
port: port_id,
cookie: *mut i32,
@@ -1255,6 +1275,7 @@ pub unsafe fn get_next_port_info(
)
}
+#[inline]
pub unsafe fn get_port_message_info_etc(
port: port_id,
info: *mut port_message_info,
@@ -1270,10 +1291,12 @@ pub unsafe fn get_port_message_info_etc(
)
}
+#[inline]
pub unsafe fn get_sem_info(id: sem_id, info: *mut sem_info) -> status_t {
_get_sem_info(id, info, core::mem::size_of::<sem_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_next_sem_info(team: team_id, cookie: *mut i32, info: *mut sem_info) -> status_t {
_get_next_sem_info(
team,
@@ -1283,14 +1306,17 @@ pub unsafe fn get_next_sem_info(team: team_id, cookie: *mut i32, info: *mut sem_
)
}
+#[inline]
pub unsafe fn get_team_info(team: team_id, info: *mut team_info) -> status_t {
_get_team_info(team, info, core::mem::size_of::<team_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_next_team_info(cookie: *mut i32, info: *mut team_info) -> status_t {
_get_next_team_info(cookie, info, core::mem::size_of::<team_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_team_usage_info(team: team_id, who: i32, info: *mut team_usage_info) -> status_t {
_get_team_usage_info(
team,
@@ -1300,10 +1326,12 @@ pub unsafe fn get_team_usage_info(team: team_id, who: i32, info: *mut team_usage
)
}
+#[inline]
pub unsafe fn get_thread_info(id: thread_id, info: *mut thread_info) -> status_t {
_get_thread_info(id, info, core::mem::size_of::<thread_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_next_thread_info(
team: team_id,
cookie: *mut i32,
@@ -1318,10 +1346,12 @@ pub unsafe fn get_next_thread_info(
}
// kernel/image.h
+#[inline]
pub unsafe fn get_image_info(image: image_id, info: *mut image_info) -> status_t {
_get_image_info(image, info, core::mem::size_of::<image_info>() as ::size_t)
}
+#[inline]
pub unsafe fn get_next_image_info(
team: team_id,
cookie: *mut i32,