eutils_rs/
helpers.rs

1use anyhow::{bail, Result};
2
3pub fn bump_memlock_rlimit() -> Result<()> {
4    let rlimit = libc::rlimit {
5        rlim_cur: 128 << 20,
6        rlim_max: 128 << 20,
7    };
8
9    if unsafe { libc::setrlimit(libc::RLIMIT_MEMLOCK, &rlimit) } != 0 {
10        bail!("Failed to increase rlimit");
11    }
12
13    Ok(())
14}