Skip to content

Commit 81efe51

Browse files
committed
Auto merge of rust-lang#268 - kamalmarhubi:prlimit, r=alexcrichton
linux: Add prlimit(2) and prlimit64(2) As with `getrlimit` and `setrlimit`, the glibc wrappers have a non-`int` for the `resource` argument, eg: extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, const struct rlimit *__new_limit, struct rlimit *__old_limit) __THROW;
2 parents 4cc1df9 + 9569599 commit 81efe51

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ fn main() {
341341

342342
"getrlimit" | "getrlimit64" | // non-int in 1st arg
343343
"setrlimit" | "setrlimit64" | // non-int in 1st arg
344+
"prlimit" | "prlimit64" | // non-int in 2nd arg
344345
"strerror_r" if linux => true, // actually xpg-something-or-other
345346

346347
// typed 2nd arg on linux and android

src/unix/notbsd/linux/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,12 @@ extern {
599599
serv: *mut ::c_char,
600600
sevlen: ::socklen_t,
601601
flags: ::c_int) -> ::c_int;
602+
pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
603+
old_limit: *mut ::rlimit) -> ::c_int;
604+
pub fn prlimit64(pid: ::pid_t,
605+
resource: ::c_int,
606+
new_limit: *const ::rlimit64,
607+
old_limit: *mut ::rlimit64) -> ::c_int;
602608
}
603609

604610
cfg_if! {

0 commit comments

Comments
 (0)