update spec links and imports for libgen and sys_resource

This commit is contained in:
auronandace
2025-10-11 19:21:36 +01:00
parent 02e4d98020
commit 03c646222e
2 changed files with 17 additions and 4 deletions
+5 -1
View File
@@ -1,4 +1,6 @@
//! libgen implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/libgen.h.html
//! `libgen.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/libgen.h.html>.
#![deny(unsafe_op_in_unsafe_fn)]
@@ -6,6 +8,7 @@ use crate::platform::types::c_char;
use crate::header::string::strlen;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/basename.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn basename(str: *mut c_char) -> *mut c_char {
if str.is_null() || unsafe { strlen(str) == 0 } {
@@ -28,6 +31,7 @@ pub unsafe extern "C" fn basename(str: *mut c_char) -> *mut c_char {
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/dirname.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn dirname(str: *mut c_char) -> *mut c_char {
if str.is_null() || unsafe { strlen(str) == 0 } {
+12 -3
View File
@@ -1,11 +1,15 @@
//! sys/resource.h implementation for Redox, following
//! http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html
//! `sys/resource.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_resource.h.html>.
use crate::{
error::ResultExt,
header::sys_time::timeval,
out::Out,
platform::{Pal, Sys, types::*},
platform::{
Pal, Sys,
types::{c_int, c_long, id_t},
},
};
// Exported in bits file
@@ -67,6 +71,7 @@ pub const PRIO_PROCESS: c_int = 0;
pub const PRIO_PGRP: c_int = 1;
pub const PRIO_USER: c_int = 2;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpriority.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn getpriority(which: c_int, who: id_t) -> c_int {
let r = Sys::getpriority(which, who).or_minus_one_errno();
@@ -76,6 +81,7 @@ pub unsafe extern "C" fn getpriority(which: c_int, who: id_t) -> c_int {
20 - r
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setpriority.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn setpriority(which: c_int, who: id_t, nice: c_int) -> c_int {
Sys::setpriority(which, who, nice)
@@ -83,6 +89,7 @@ pub unsafe extern "C" fn setpriority(which: c_int, who: id_t, nice: c_int) -> c_
.or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getrlimit.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
let rlp = Out::nonnull(rlp);
@@ -92,6 +99,7 @@ pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
.or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setrlimit.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
Sys::setrlimit(resource, rlp)
@@ -99,6 +107,7 @@ pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int
.or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getrusage.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
Sys::getrusage(who, Out::nonnull(r_usage))