Fix RawFd import paths

pull/1/head
Alessandro Decina 4 years ago
parent 2cec04c578
commit 3abe9bb859

@ -3,6 +3,7 @@ use std::{
marker::PhantomData, marker::PhantomData,
mem, mem,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
os::unix::io::RawFd,
}; };
use crate::{ use crate::{
@ -12,7 +13,7 @@ use crate::{
bpf_map_delete_elem, bpf_map_lookup_and_delete_elem, bpf_map_lookup_elem, bpf_map_delete_elem, bpf_map_lookup_and_delete_elem, bpf_map_lookup_elem,
bpf_map_update_elem, bpf_map_update_elem,
}, },
Pod, RawFd, Pod,
}; };
pub struct HashMap<T: Deref<Target = Map>, K, V> { pub struct HashMap<T: Deref<Target = Map>, K, V> {

@ -1,10 +1,10 @@
use std::{ffi::CString, io}; use std::{ffi::CString, io, os::unix::io::RawFd};
use thiserror::Error; use thiserror::Error;
use crate::{ use crate::{
obj, obj,
sys::{bpf_create_map, bpf_map_get_next_key}, sys::{bpf_create_map, bpf_map_get_next_key},
Pod, RawFd, Pod,
}; };
mod hash_map; mod hash_map;

@ -1,7 +1,7 @@
use std::{ use std::{
ffi::c_void, ffi::c_void,
io, mem, io, mem,
os::unix::prelude::AsRawFd, os::unix::io::{AsRawFd, RawFd},
ptr, slice, ptr, slice,
sync::atomic::{self, AtomicPtr, Ordering}, sync::atomic::{self, AtomicPtr, Ordering},
}; };
@ -13,7 +13,7 @@ use thiserror::Error;
use crate::{ use crate::{
generated::{perf_event_header, perf_event_mmap_page, perf_event_type::*}, generated::{perf_event_header, perf_event_mmap_page, perf_event_type::*},
sys::{perf_event_ioctl, perf_event_open}, sys::{perf_event_ioctl, perf_event_open},
RawFd, PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE,
}; };
#[derive(Error, Debug)] #[derive(Error, Debug)]

@ -1,4 +1,10 @@
use std::{convert::TryFrom, io, ops::DerefMut, os::unix::prelude::AsRawFd, sync::Arc}; use std::{
convert::TryFrom,
io,
ops::DerefMut,
os::unix::io::{AsRawFd, RawFd},
sync::Arc,
};
use bytes::BytesMut; use bytes::BytesMut;
use libc::{sysconf, _SC_PAGESIZE}; use libc::{sysconf, _SC_PAGESIZE};
@ -9,7 +15,6 @@ use crate::{
maps::perf_map::{Events, PerfBuffer, PerfBufferError}, maps::perf_map::{Events, PerfBuffer, PerfBufferError},
maps::{Map, MapError, MapRefMut}, maps::{Map, MapError, MapRefMut},
sys::bpf_map_update_elem, sys::bpf_map_update_elem,
RawFd,
}; };
#[derive(Error, Debug)] #[derive(Error, Debug)]

@ -5,7 +5,10 @@ pub mod trace_point;
pub mod xdp; pub mod xdp;
use libc::{close, ENOSPC}; use libc::{close, ENOSPC};
use std::{cell::RefCell, cmp, convert::TryFrom, ffi::CStr, io, os::raw::c_uint, rc::Rc}; use std::{
cell::RefCell, cmp, convert::TryFrom, ffi::CStr, io, os::raw::c_uint, os::unix::io::RawFd,
rc::Rc,
};
use thiserror::Error; use thiserror::Error;
use perf_attach::*; use perf_attach::*;
@ -14,7 +17,7 @@ pub use socket_filter::{SocketFilter, SocketFilterError};
pub use trace_point::{TracePoint, TracePointError}; pub use trace_point::{TracePoint, TracePointError};
pub use xdp::{Xdp, XdpError}; pub use xdp::{Xdp, XdpError};
use crate::{obj, sys::bpf_load_program, RawFd}; use crate::{obj, sys::bpf_load_program};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum ProgramError { pub enum ProgramError {
#[error("the program is already loaded")] #[error("the program is already loaded")]

@ -1,8 +1,8 @@
use libc::close; use libc::close;
use std::os::unix::io::RawFd;
use crate::{ use crate::{
sys::perf_event_ioctl, RawFd, PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, sys::perf_event_ioctl, PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, PERF_EVENT_IOC_SET_BPF,
PERF_EVENT_IOC_SET_BPF,
}; };
use super::{Link, LinkRef, ProgramData, ProgramError}; use super::{Link, LinkRef, ProgramData, ProgramError};

@ -1,6 +1,6 @@
use bitflags; use bitflags;
use libc::if_nametoindex; use libc::if_nametoindex;
use std::{ffi::CString, io}; use std::{ffi::CString, io, os::unix::io::RawFd};
use thiserror::Error; use thiserror::Error;
use crate::{ use crate::{
@ -12,7 +12,6 @@ use crate::{
sys::bpf_link_create, sys::bpf_link_create,
sys::kernel_version, sys::kernel_version,
sys::netlink_set_xdp_fd, sys::netlink_set_xdp_fd,
RawFd,
}; };
#[derive(Debug, Error)] #[derive(Debug, Error)]

@ -3,6 +3,7 @@ use std::{
ffi::CStr, ffi::CStr,
io, io,
mem::{self, MaybeUninit}, mem::{self, MaybeUninit},
os::unix::io::RawFd,
slice, slice,
}; };
@ -13,7 +14,7 @@ use crate::{
generated::{bpf_attach_type, bpf_attr, bpf_cmd, bpf_insn}, generated::{bpf_attach_type, bpf_attr, bpf_cmd, bpf_insn},
programs::VerifierLog, programs::VerifierLog,
sys::SysResult, sys::SysResult,
Pod, RawFd, BPF_OBJ_NAME_LEN, Pod, BPF_OBJ_NAME_LEN,
}; };
use super::{syscall, Syscall}; use super::{syscall, Syscall};

Loading…
Cancel
Save