![Latest Version] ![Documentation] ![License]
A simple wrapper for getrlimit
and setrlimit
.
```rust use rlimit::{setrlimit, Resource, Rlim};
const DEFAULTSOFTLIMIT: Rlim = Rlim::fromraw(4 * 1024 * 1024); const DEFAULTHARDLIMIT: Rlim = Rlim::fromraw(8 * 1024 * 1024); assert!(Resource::FSIZE.set(DEFAULTSOFTLIMIT, DEFAULTHARDLIMIT).is_ok());
let soft = Rlim::fromusize(16384); let hard = soft * 2; assert!(setrlimit(Resource::NOFILE, soft, hard).isok()); ```
```rust use rlimit::{getrlimit, Resource, Rlim};
assert!(Resource::NOFILE.get().isok()); asserteq!(getrlimit(Resource::CPU).unwrap(), (Rlim::INFINITY, Rlim::INFINITY)); ```
See the example nofile.