From 41c33901ff6a70e87e649ba61c5d52c84f661ed1 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 6 Oct 2024 18:36:08 +0200 Subject: [PATCH] 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. --- radicle/src/io.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/radicle/src/io.rs b/radicle/src/io.rs index 8af88728..7e319ef4 100644 --- a/radicle/src/io.rs +++ b/radicle/src/io.rs @@ -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) -> io::Result