Merge branch 'setrlimit_impl' into 'master'
sys_resource: setrlimit implementation proposal. See merge request redox-os/relibc!366
This commit is contained in:
@@ -71,6 +71,10 @@ pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
|
||||
Sys::getrlimit(resource, rlp)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
|
||||
Sys::setrlimit(rsource, rlp)
|
||||
}
|
||||
// #[no_mangle]
|
||||
// pub unsafe extern "C" fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
|
||||
// // Sys::getrusage(who, r_usage)
|
||||
@@ -82,7 +86,3 @@ pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
|
||||
// unimplemented!();
|
||||
// }
|
||||
//
|
||||
// #[no_mangle]
|
||||
// pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
|
||||
// unimplemented!();
|
||||
// }
|
||||
|
||||
@@ -267,6 +267,10 @@ impl Pal for Sys {
|
||||
e(syscall!(GETRLIMIT, resource, rlim)) as c_int
|
||||
}
|
||||
|
||||
unsafe fn setrlimit(resource: c_int, rlimit: *const rlimit) -> c_int {
|
||||
e(syscall!(SETRLIMIT, resource, rlim)) as c_int
|
||||
}
|
||||
|
||||
fn getsid(pid: pid_t) -> pid_t {
|
||||
e(unsafe { syscall!(GETSID, pid) }) as pid_t
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ pub trait Pal {
|
||||
|
||||
unsafe fn getrlimit(resource: c_int, rlim: *mut rlimit) -> c_int;
|
||||
|
||||
unsafe fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int;
|
||||
|
||||
fn getsid(pid: pid_t) -> pid_t;
|
||||
|
||||
fn gettid() -> pid_t;
|
||||
|
||||
@@ -535,6 +535,11 @@ impl Pal for Sys {
|
||||
0
|
||||
}
|
||||
|
||||
unsafe fn setrlimit(resource: c_int, rlim: *const rlimit) -> c_int {
|
||||
unsafe { errno = EPERM };
|
||||
-1
|
||||
}
|
||||
|
||||
fn getsid(pid: pid_t) -> pid_t {
|
||||
//TODO
|
||||
unsafe { errno = ENOSYS };
|
||||
|
||||
Reference in New Issue
Block a user