2024-12-20 23:00:43 +02:00
|
|
|
use core::{ffi::c_int, ptr::NonNull};
|
2024-11-12 17:50:38 +02:00
|
|
|
|
|
|
|
use super::{sys_time::__ygg_timeval_t, sys_types::id_t};
|
|
|
|
|
|
|
|
pub type rlim_t = u64;
|
|
|
|
|
2025-02-26 11:52:05 +02:00
|
|
|
pub type __ygg_rusage_t = rusage;
|
|
|
|
|
2024-11-12 17:50:38 +02:00
|
|
|
pub const PRIO_PROCESS: c_int = 0;
|
|
|
|
pub const PRIO_PGRP: c_int = 1;
|
|
|
|
pub const PRIO_USER: c_int = 2;
|
|
|
|
|
|
|
|
pub const RLIM_INFINITY: rlim_t = u64::MAX;
|
|
|
|
pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
|
|
|
|
pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
|
|
|
|
|
|
|
|
pub const RUSAGE_SELF: c_int = 0;
|
|
|
|
|
|
|
|
pub const RLIMIT_CORE: c_int = 1;
|
|
|
|
pub const RLIMIT_CPU: c_int = 2;
|
|
|
|
pub const RLIMIT_DATA: c_int = 3;
|
|
|
|
pub const RLIMIT_FSIZE: c_int = 4;
|
|
|
|
pub const RLIMIT_NOFILE: c_int = 5;
|
|
|
|
pub const RLIMIT_STACK: c_int = 6;
|
|
|
|
pub const RLIMIT_AS: c_int = 7;
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct rlimit {
|
|
|
|
pub rlim_cur: rlim_t,
|
|
|
|
pub rlim_max: rlim_t
|
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct rusage {
|
|
|
|
pub ru_utime: __ygg_timeval_t,
|
|
|
|
pub ru_stime: __ygg_timeval_t
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
unsafe extern "C" fn getpriority(_which: c_int, _who: id_t) -> c_int {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
2024-12-20 23:00:43 +02:00
|
|
|
unsafe extern "C" fn getrlimit(_which: c_int, rlimit: *mut rlimit) -> c_int {
|
|
|
|
if let Some(rlimit) = NonNull::new(rlimit) {
|
|
|
|
rlimit.write(rlimit {
|
|
|
|
rlim_cur: 0,
|
|
|
|
rlim_max: 0,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
-1
|
2024-11-12 17:50:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
unsafe extern "C" fn getrusage(_which: c_int, _rusage: *mut rusage) -> c_int {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
unsafe extern "C" fn setpriority(_which: c_int, _who: id_t, _prio: c_int) -> c_int {
|
|
|
|
todo!()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
unsafe extern "C" fn setrlimit(_which: c_int, _rlimit: *const rlimit) -> c_int {
|
|
|
|
todo!()
|
|
|
|
}
|