diff --git a/src/header/langinfo/mod.rs b/src/header/langinfo/mod.rs index 0a9c265b73..c71b2e9342 100644 --- a/src/header/langinfo/mod.rs +++ b/src/header/langinfo/mod.rs @@ -1,10 +1,13 @@ -// langinfo.h implementation for Redox, following the POSIX standard. -// Following https://pubs.opengroup.org/onlinepubs/7908799/xsh/langinfo.h.html -// +//! `langinfo.h` implementation. +//! +//! See . + // TODO : involve loading locale data. Currently, the implementation only supports the "C" locale. use core::ffi::c_char; +/// See . +/// /// POSIX type for items used with `nl_langinfo` /// In practice, this is an integer index into the string table. pub type nl_item = i32; @@ -130,10 +133,12 @@ pub const RADIXCHAR: nl_item = 50; pub const THOUSEP: nl_item = 51; pub const YESEXPR: nl_item = 52; pub const NOEXPR: nl_item = 53; -pub const YESSTR: nl_item = 54; // Legaxy +pub const YESSTR: nl_item = 54; // Legacy pub const NOSTR: nl_item = 55; // Legacy pub const CRNCYSTR: nl_item = 56; +/// See . +/// /// Get a string from the langinfo table /// /// # Safety diff --git a/src/header/limits/mod.rs b/src/header/limits/mod.rs index 55b07dfe3d..ae29aa6b84 100644 --- a/src/header/limits/mod.rs +++ b/src/header/limits/mod.rs @@ -1,5 +1,6 @@ -//! limits.h implementation for relibc -//! Following https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html +//! `limits.h` implementation. +//! +//! See . use core::ffi::c_long; diff --git a/src/header/monetary/mod.rs b/src/header/monetary/mod.rs index d8c6d231f9..5c2f8cb9fb 100644 --- a/src/header/monetary/mod.rs +++ b/src/header/monetary/mod.rs @@ -1,9 +1,10 @@ -/// `monetary.h` implementation. -/// -/// See . -/// -/// We should provide a strfmon() implementation that formats a monetary value, -/// according to the current locale (TODO). +//! `monetary.h` implementation. +//! +//! See . + +// We should provide a strfmon() implementation that formats a monetary value, +// according to the current locale (TODO). + use alloc::string::{String, ToString}; use core::{ffi::CStr, ptr, slice, str}; diff --git a/src/header/pwd/mod.rs b/src/header/pwd/mod.rs index d9e625ec53..478afcc77b 100644 --- a/src/header/pwd/mod.rs +++ b/src/header/pwd/mod.rs @@ -252,7 +252,7 @@ pub extern "C" fn getpwent() -> *mut passwd { /// See . #[unsafe(no_mangle)] -pub extern "C" fn getpwnam(name: *const c_char) -> *mut passwd { +pub unsafe extern "C" fn getpwnam(name: *const c_char) -> *mut passwd { pwd_lookup(|parts| unsafe { strcmp(parts.pw_name, name) } == 0, None) .map(|res| res.into_global()) .unwrap_or(ptr::null_mut()) diff --git a/src/header/sys_syslog/mod.rs b/src/header/sys_syslog/mod.rs index 0f6dc34e1b..0a17dd6c6e 100644 --- a/src/header/sys_syslog/mod.rs +++ b/src/header/sys_syslog/mod.rs @@ -1,5 +1,8 @@ -// This is syslog.h implemented based on POSIX.1-2017 -// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/syslog.h.html +//! `syslog.h` implementation. +//! +//! See . + +// Exported as both syslog.h and sys/syslog.h. #[cfg(target_os = "redox")] #[path = "redox.rs"] @@ -13,7 +16,10 @@ pub mod logger; use core::ffi::VaList; -use crate::{c_str::CStr, platform::types::*}; +use crate::{ + c_str::CStr, + platform::types::{c_char, c_int}, +}; use logger::{LOGGER, Priority}; /// Record the caller's PID in log messages. @@ -74,6 +80,7 @@ pub const extern "C" fn LOG_MASK(p: c_int) -> c_int { 1 << p } +/// See . #[unsafe(no_mangle)] pub extern "C" fn setlogmask(mask: c_int) -> c_int { let mut params = LOGGER.lock(); @@ -86,6 +93,7 @@ pub extern "C" fn setlogmask(mask: c_int) -> c_int { old } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn openlog(ident: *const c_char, opt: c_int, facility: c_int) { let ident = unsafe { CStr::from_nullable_ptr(ident) }; @@ -107,6 +115,9 @@ pub unsafe extern "C" fn openlog(ident: *const c_char, opt: c_int, facility: c_i } } +/// See . +/// +/// Non-POSIX, 4.3BSD-Reno. #[unsafe(no_mangle)] pub unsafe extern "C" fn vsyslog(priority: c_int, message: *const c_char, mut ap: VaList) { let Some(message) = CStr::from_nullable_ptr(message) else { @@ -122,11 +133,13 @@ pub unsafe extern "C" fn vsyslog(priority: c_int, message: *const c_char, mut ap } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn syslog(priority: c_int, message: *const c_char, mut __valist: ...) { vsyslog(priority, message, __valist.as_va_list()); } +/// See . #[unsafe(no_mangle)] pub extern "C" fn closelog() { LOGGER.lock().close(); diff --git a/src/header/sys_types/mod.rs b/src/header/sys_types/mod.rs index caa9abf16d..1387dba700 100644 --- a/src/header/sys_types/mod.rs +++ b/src/header/sys_types/mod.rs @@ -1 +1,3 @@ -//! sys/types.h +//! `sys/types.h` implementation. +//! +//! See . diff --git a/src/header/tar/mod.rs b/src/header/tar/mod.rs index 52dffe3e35..41d9215b27 100644 --- a/src/header/tar/mod.rs +++ b/src/header/tar/mod.rs @@ -1,5 +1,6 @@ -//! tar.h implementation for Redox, following POSIX.1-1990 specification -//! and https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/tar.h.html +//! `tar.h` implementation. +//! +//! See . use core::slice;