|
|
@ -61,6 +61,7 @@ use std::{
|
|
|
|
|
|
|
|
|
|
|
|
use libc::{getrlimit, rlim_t, rlimit, RLIMIT_MEMLOCK, RLIM_INFINITY};
|
|
|
|
use libc::{getrlimit, rlim_t, rlimit, RLIMIT_MEMLOCK, RLIM_INFINITY};
|
|
|
|
use log::warn;
|
|
|
|
use log::warn;
|
|
|
|
|
|
|
|
use obj::maps::InvalidMapTypeError;
|
|
|
|
use thiserror::Error;
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
@ -193,6 +194,16 @@ pub enum MapError {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note that this is not just derived using #[from] because InvalidMapTypeError cannot implement
|
|
|
|
|
|
|
|
// Error due the the fact that aya-obj is no_std and error_in_core is not stabilized
|
|
|
|
|
|
|
|
// (https://github.com/rust-lang/rust/issues/103765).
|
|
|
|
|
|
|
|
impl From<InvalidMapTypeError> for MapError {
|
|
|
|
|
|
|
|
fn from(e: InvalidMapTypeError) -> Self {
|
|
|
|
|
|
|
|
let InvalidMapTypeError { map_type } = e;
|
|
|
|
|
|
|
|
Self::InvalidMapType { map_type }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// A map file descriptor.
|
|
|
|
/// A map file descriptor.
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct MapFd(OwnedFd);
|
|
|
|
pub struct MapFd(OwnedFd);
|
|
|
|