update spec links and imports for libgen and sys_resource
This commit is contained in:
@@ -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 } {
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user