|
1 | 1 | use crate::prelude::*;
|
2 | 2 |
|
| 3 | +// This module contains bindings to the native Haiku API. The Haiku API |
| 4 | +// originates from BeOS, and it was the original way to perform low level |
| 5 | +// system and IO operations. The POSIX API was in that era was like a |
| 6 | +// compatibility layer. In current Haiku development, both the POSIX API and |
| 7 | +// the Haiku API are considered to be co-equal status. However, they are not |
| 8 | +// integrated like they are on other UNIX platforms, which means that for many |
| 9 | +// low level concepts there are two versions, like processes (POSIX) and |
| 10 | +// teams (Haiku), or pthreads and native threads. |
| 11 | +// |
| 12 | +// Both the POSIX API and the Haiku API live in libroot.so, the library that is |
| 13 | +// linked to any binary by default. Additionally, Haiku supports several |
| 14 | +// non-POSIX APIs from BSD and GNU, which live in libbsd.so and libgnu.so. These |
| 15 | +// modules are also supported. |
| 16 | +// |
| 17 | +// The module is comprised of the following files: |
| 18 | +// - `mod.rs` (this file) implements the C11 and POSIX API found in |
| 19 | +// `headers/posix` |
| 20 | +// - `b32.rs`, `b64.rs` and `x86_64.rs` contain platform-specific definitions |
| 21 | +// of the C11 and POSIX APIs |
| 22 | +// - `native.rs` defines the native Haiku API that is implemented in |
| 23 | +// `libroot.so` and that are found in `headers/os`. |
| 24 | +// - `bsd.rs` defines the BSD customizations available on Haiku found in |
| 25 | +// `headers/compatibility/bsd` |
| 26 | + |
3 | 27 | pub type rlim_t = crate::uintptr_t;
|
4 | 28 | pub type sa_family_t = u8;
|
5 | 29 | pub type pthread_key_t = c_int;
|
@@ -56,8 +80,6 @@ pub type ACTION = c_int;
|
56 | 80 | pub type posix_spawnattr_t = *mut c_void;
|
57 | 81 | pub type posix_spawn_file_actions_t = *mut c_void;
|
58 | 82 |
|
59 |
| -pub type StringList = _stringlist; |
60 |
| - |
61 | 83 | #[cfg_attr(feature = "extra_traits", derive(Debug))]
|
62 | 84 | pub enum timezone {}
|
63 | 85 | impl Copy for timezone {}
|
@@ -440,19 +462,6 @@ s! {
|
440 | 462 | pub flag: *mut c_int,
|
441 | 463 | pub val: c_int,
|
442 | 464 | }
|
443 |
| - |
444 |
| - pub struct _stringlist { |
445 |
| - pub sl_str: *mut *mut c_char, |
446 |
| - pub sl_max: size_t, |
447 |
| - pub sl_cur: size_t, |
448 |
| - } |
449 |
| - |
450 |
| - pub struct dl_phdr_info { |
451 |
| - pub dlpi_addr: crate::Elf_Addr, |
452 |
| - pub dlpi_name: *const c_char, |
453 |
| - pub dlpi_phdr: *const crate::Elf_Phdr, |
454 |
| - pub dlpi_phnum: crate::Elf_Half, |
455 |
| - } |
456 | 465 | }
|
457 | 466 |
|
458 | 467 | s_no_extra_traits! {
|
@@ -1829,7 +1838,6 @@ extern "C" {
|
1829 | 1838 | addr: *mut crate::sockaddr,
|
1830 | 1839 | addrlen: *mut crate::socklen_t,
|
1831 | 1840 | ) -> ssize_t;
|
1832 |
| - pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; |
1833 | 1841 | pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char;
|
1834 | 1842 |
|
1835 | 1843 | pub fn bind(
|
@@ -2086,46 +2094,6 @@ extern "C" {
|
2086 | 2094 | pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int;
|
2087 | 2095 | }
|
2088 | 2096 |
|
2089 |
| -#[link(name = "bsd")] |
2090 |
| -extern "C" { |
2091 |
| - pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int; |
2092 |
| - pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int; |
2093 |
| - pub fn forkpty( |
2094 |
| - amaster: *mut c_int, |
2095 |
| - name: *mut c_char, |
2096 |
| - termp: *mut termios, |
2097 |
| - winp: *mut crate::winsize, |
2098 |
| - ) -> crate::pid_t; |
2099 |
| - pub fn openpty( |
2100 |
| - amaster: *mut c_int, |
2101 |
| - aslave: *mut c_int, |
2102 |
| - name: *mut c_char, |
2103 |
| - termp: *mut termios, |
2104 |
| - winp: *mut crate::winsize, |
2105 |
| - ) -> c_int; |
2106 |
| - pub fn strsep(string: *mut *mut c_char, delimiters: *const c_char) -> *mut c_char; |
2107 |
| - pub fn explicit_bzero(buf: *mut c_void, len: size_t); |
2108 |
| - pub fn login_tty(_fd: c_int) -> c_int; |
2109 |
| - |
2110 |
| - pub fn sl_init() -> *mut StringList; |
2111 |
| - pub fn sl_add(sl: *mut StringList, n: *mut c_char) -> c_int; |
2112 |
| - pub fn sl_free(sl: *mut StringList, i: c_int); |
2113 |
| - pub fn sl_find(sl: *mut StringList, n: *mut c_char) -> *mut c_char; |
2114 |
| - |
2115 |
| - pub fn getprogname() -> *const c_char; |
2116 |
| - pub fn setprogname(progname: *const c_char); |
2117 |
| - pub fn dl_iterate_phdr( |
2118 |
| - callback: Option< |
2119 |
| - unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int, |
2120 |
| - >, |
2121 |
| - data: *mut c_void, |
2122 |
| - ) -> c_int; |
2123 |
| - |
2124 |
| - pub fn arc4random() -> u32; |
2125 |
| - pub fn arc4random_uniform(upper_bound: u32) -> u32; |
2126 |
| - pub fn arc4random_buf(buf: *mut c_void, n: size_t); |
2127 |
| -} |
2128 |
| - |
2129 | 2097 | #[link(name = "gnu")]
|
2130 | 2098 | extern "C" {
|
2131 | 2099 | pub fn memmem(
|
@@ -2169,5 +2137,8 @@ cfg_if! {
|
2169 | 2137 | }
|
2170 | 2138 | }
|
2171 | 2139 |
|
| 2140 | +mod bsd; |
| 2141 | +pub use self::bsd::*; |
| 2142 | + |
2172 | 2143 | mod native;
|
2173 | 2144 | pub use self::native::*;
|
0 commit comments