radicle: use rlim_t when working with limits
rlimit values have different types on Linux and FreeBSD, as well as 64-bit and 32-bit platforms, so stick to the type rlim_t provided by the libc crate.
This commit is contained in:
parent
c8062bc4a7
commit
41c33901ff
|
|
@ -1,12 +1,9 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use libc::{getrlimit, rlimit, setrlimit, RLIMIT_NOFILE};
|
use libc::{getrlimit, rlim_t, rlimit, setrlimit, RLIMIT_NOFILE};
|
||||||
|
|
||||||
#[cfg(not(target_os = "freebsd"))]
|
type Int = rlim_t;
|
||||||
type Int = u64;
|
|
||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
type Int = i64;
|
|
||||||
|
|
||||||
/// Sets the open file limit to the given value, or the maximum allowed value.
|
/// Sets the open file limit to the given value, or the maximum allowed value.
|
||||||
pub fn set_file_limit<N>(n: N) -> io::Result<Int>
|
pub fn set_file_limit<N>(n: N) -> io::Result<Int>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue