Add docs for unistd submodules
This commit is contained in:
@@ -8,6 +8,12 @@ use crate::{
|
||||
|
||||
static mut BRK: *mut c_void = ptr::null_mut();
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xsh/brk.html>.
|
||||
///
|
||||
/// # Deprecation
|
||||
/// The `brk()` function was marked legacy in the System Interface & Headers
|
||||
/// Issue 5, and removed in Issue 6.
|
||||
#[deprecated]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn brk(addr: *mut c_void) -> c_int {
|
||||
BRK = Sys::brk(addr).or_errno_null_mut();
|
||||
@@ -20,6 +26,12 @@ pub unsafe extern "C" fn brk(addr: *mut c_void) -> c_int {
|
||||
0
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xsh/brk.html>.
|
||||
///
|
||||
/// # Deprecation
|
||||
/// The `sbrk()` function was marked legacy in the System Interface & Headers
|
||||
/// Issue 5, and removed in Issue 6.
|
||||
#[deprecated]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sbrk(incr: intptr_t) -> *mut c_void {
|
||||
if BRK.is_null() {
|
||||
|
||||
@@ -4,26 +4,31 @@ use core::ptr;
|
||||
|
||||
use crate::{header::getopt, platform::types::*};
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub static mut optarg: *mut c_char = ptr::null_mut();
|
||||
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub static mut optind: c_int = 1;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub static mut opterr: c_int = 1;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub static mut optind: c_int = 1;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub static mut optopt: c_int = -1;
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getopt.html>.
|
||||
#[no_mangle]
|
||||
#[linkage = "weak"] // often redefined in GNU programs
|
||||
pub unsafe extern "C" fn getopt(
|
||||
|
||||
@@ -60,6 +60,12 @@ fn getpass_rs(prompt: CStr, passbuff: &mut [u8]) -> Result<*mut c_char, io::Erro
|
||||
Ok(passbuff.as_mut_ptr() as *mut c_char)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/7908799/xsh/getpass.html>.
|
||||
///
|
||||
/// # Deprecation
|
||||
/// The `getpass()` function was marked legacy in the Open Group System
|
||||
/// Interface & Headers Issue 5, and removed in Issue 6.
|
||||
#[deprecated]
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn getpass(prompt: *const c_char) -> *mut c_char {
|
||||
static mut PASSBUFF: [u8; PASS_MAX] = [0; PASS_MAX];
|
||||
|
||||
@@ -56,11 +56,13 @@ fn pc(name: c_int) -> c_long {
|
||||
}
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fpathconf.html>.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn fpathconf(_fildes: c_int, name: c_int) -> c_long {
|
||||
pc(name)
|
||||
}
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fpathconf.html>.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn pathconf(_path: *const c_char, name: c_int) -> c_long {
|
||||
pc(name)
|
||||
|
||||
@@ -33,6 +33,7 @@ pub const _SC_SYMLOOP_MAX: c_int = 173;
|
||||
pub const _SC_HOST_NAME_MAX: c_int = 180;
|
||||
// } POSIX.1
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sysconf.html>.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sysconf(name: c_int) -> c_long {
|
||||
//TODO: Real values
|
||||
|
||||
Reference in New Issue
Block a user