|
|
@ -33,7 +33,7 @@
|
|
|
|
//! versa. Because of that, all map values must be plain old data and therefore
|
|
|
|
//! versa. Because of that, all map values must be plain old data and therefore
|
|
|
|
//! implement the [Pod] trait.
|
|
|
|
//! implement the [Pod] trait.
|
|
|
|
use std::{
|
|
|
|
use std::{
|
|
|
|
convert::TryFrom,
|
|
|
|
convert::{TryFrom, TryInto},
|
|
|
|
ffi::CString,
|
|
|
|
ffi::CString,
|
|
|
|
fmt, io,
|
|
|
|
fmt, io,
|
|
|
|
marker::PhantomData,
|
|
|
|
marker::PhantomData,
|
|
|
@ -226,7 +226,7 @@ impl AsRawFd for MapFd {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
struct RlimitSize(u64);
|
|
|
|
struct RlimitSize(usize);
|
|
|
|
impl fmt::Display for RlimitSize {
|
|
|
|
impl fmt::Display for RlimitSize {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
if self.0 < 1024 {
|
|
|
|
if self.0 < 1024 {
|
|
|
@ -246,8 +246,9 @@ fn maybe_warn_rlimit() {
|
|
|
|
let ret = unsafe { getrlimit(RLIMIT_MEMLOCK, limit.as_mut_ptr()) };
|
|
|
|
let ret = unsafe { getrlimit(RLIMIT_MEMLOCK, limit.as_mut_ptr()) };
|
|
|
|
if ret == 0 {
|
|
|
|
if ret == 0 {
|
|
|
|
let limit = unsafe { limit.assume_init() };
|
|
|
|
let limit = unsafe { limit.assume_init() };
|
|
|
|
let limit: RlimitSize = RlimitSize(limit.rlim_cur);
|
|
|
|
|
|
|
|
if limit.0 == RLIM_INFINITY {
|
|
|
|
let limit: RlimitSize = RlimitSize(limit.rlim_cur.try_into().unwrap());
|
|
|
|
|
|
|
|
if limit.0 == RLIM_INFINITY.try_into().unwrap() {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
warn!(
|
|
|
|
warn!(
|
|
|
|