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:
Leah Neukirchen 2024-10-06 18:36:08 +02:00 committed by cloudhead
parent c8062bc4a7
commit 41c33901ff
No known key found for this signature in database
1 changed files with 2 additions and 5 deletions

View File

@ -1,12 +1,9 @@
use std::fmt;
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 = u64;
#[cfg(target_os = "freebsd")]
type Int = i64;
type Int = rlim_t;
/// 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>