|
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! { |
@@ -1772,7 +1781,6 @@ extern "C" { |
1772 | 1781 | addr: *mut crate::sockaddr, |
1773 | 1782 | addrlen: *mut crate::socklen_t, |
1774 | 1783 | ) -> ssize_t; |
1775 | | - pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; |
1776 | 1784 | pub fn nl_langinfo(item: crate::nl_item) -> *mut c_char; |
1777 | 1785 |
|
1778 | 1786 | pub fn bind( |
@@ -2032,46 +2040,6 @@ extern "C" { |
2032 | 2040 | pub fn getentropy(buf: *mut c_void, buflen: size_t) -> c_int; |
2033 | 2041 | } |
2034 | 2042 |
|
2035 | | -#[link(name = "bsd")] |
2036 | | -extern "C" { |
2037 | | - pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int; |
2038 | | - pub fn daemon(nochdir: c_int, noclose: c_int) -> c_int; |
2039 | | - pub fn forkpty( |
2040 | | - amaster: *mut c_int, |
2041 | | - name: *mut c_char, |
2042 | | - termp: *mut termios, |
2043 | | - winp: *mut crate::winsize, |
2044 | | - ) -> crate::pid_t; |
2045 | | - pub fn openpty( |
2046 | | - amaster: *mut c_int, |
2047 | | - aslave: *mut c_int, |
2048 | | - name: *mut c_char, |
2049 | | - termp: *mut termios, |
2050 | | - winp: *mut crate::winsize, |
2051 | | - ) -> c_int; |
2052 | | - pub fn strsep(string: *mut *mut c_char, delimiters: *const c_char) -> *mut c_char; |
2053 | | - pub fn explicit_bzero(buf: *mut c_void, len: size_t); |
2054 | | - pub fn login_tty(_fd: c_int) -> c_int; |
2055 | | - |
2056 | | - pub fn sl_init() -> *mut StringList; |
2057 | | - pub fn sl_add(sl: *mut StringList, n: *mut c_char) -> c_int; |
2058 | | - pub fn sl_free(sl: *mut StringList, i: c_int); |
2059 | | - pub fn sl_find(sl: *mut StringList, n: *mut c_char) -> *mut c_char; |
2060 | | - |
2061 | | - pub fn getprogname() -> *const c_char; |
2062 | | - pub fn setprogname(progname: *const c_char); |
2063 | | - pub fn dl_iterate_phdr( |
2064 | | - callback: Option< |
2065 | | - unsafe extern "C" fn(info: *mut dl_phdr_info, size: usize, data: *mut c_void) -> c_int, |
2066 | | - >, |
2067 | | - data: *mut c_void, |
2068 | | - ) -> c_int; |
2069 | | - |
2070 | | - pub fn arc4random() -> u32; |
2071 | | - pub fn arc4random_uniform(upper_bound: u32) -> u32; |
2072 | | - pub fn arc4random_buf(buf: *mut c_void, n: size_t); |
2073 | | -} |
2074 | | - |
2075 | 2043 | #[link(name = "gnu")] |
2076 | 2044 | extern "C" { |
2077 | 2045 | pub fn memmem( |
@@ -2115,5 +2083,8 @@ cfg_if! { |
2115 | 2083 | } |
2116 | 2084 | } |
2117 | 2085 |
|
| 2086 | +mod bsd; |
| 2087 | +pub use self::bsd::*; |
| 2088 | + |
2118 | 2089 | mod native; |
2119 | 2090 | pub use self::native::*; |
0 commit comments