aya: import types from std::ffi rather than libc

pull/811/head
Tamir Duberstein 1 year ago
parent ef27bce619
commit 5cdd1baf29
No known key found for this signature in database

@ -49,7 +49,7 @@
//! implement the [Pod] trait. //! implement the [Pod] trait.
use std::{ use std::{
borrow::BorrowMut, borrow::BorrowMut,
ffi::CString, ffi::{c_long, CString},
fmt, io, fmt, io,
marker::PhantomData, marker::PhantomData,
mem, mem,
@ -122,7 +122,7 @@ pub enum MapError {
/// Map name /// Map name
name: String, name: String,
/// Error code /// Error code
code: libc::c_long, code: c_long,
#[source] #[source]
/// Original io::Error /// Original io::Error
io_error: io::Error, io_error: io::Error,

@ -1,5 +1,5 @@
use std::{ use std::{
ffi::c_void, ffi::{c_int, c_void},
io, mem, io, mem,
os::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd}, os::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd},
ptr, slice, ptr, slice,
@ -7,7 +7,7 @@ use std::{
}; };
use bytes::BytesMut; use bytes::BytesMut;
use libc::{c_int, munmap, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE}; use libc::{munmap, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE};
use thiserror::Error; use thiserror::Error;
use crate::{ use crate::{

@ -1,6 +1,6 @@
use std::{ use std::{
cmp, cmp,
ffi::{CStr, CString}, ffi::{c_char, c_long, CStr, CString},
io, iter, io, iter,
mem::{self, MaybeUninit}, mem::{self, MaybeUninit},
os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, FromRawFd as _, OwnedFd, RawFd}, os::fd::{AsFd as _, AsRawFd as _, BorrowedFd, FromRawFd as _, OwnedFd, RawFd},
@ -8,7 +8,7 @@ use std::{
}; };
use assert_matches::assert_matches; use assert_matches::assert_matches;
use libc::{c_char, c_long, ENOENT, ENOSPC}; use libc::{ENOENT, ENOSPC};
use obj::{ use obj::{
btf::{BtfEnum64, Enum64}, btf::{BtfEnum64, Enum64},
maps::{bpf_map_def, LegacyMap}, maps::{bpf_map_def, LegacyMap},

@ -1,6 +1,8 @@
use std::{cell::RefCell, ffi::c_long, io, ptr}; use std::{
cell::RefCell,
use libc::c_void; ffi::{c_long, c_void},
io, ptr,
};
use super::{SysResult, Syscall}; use super::{SysResult, Syscall};

@ -6,6 +6,7 @@ mod perf_event;
mod fake; mod fake;
use std::{ use std::{
ffi::{c_int, c_long},
io, mem, io, mem,
os::fd::{AsRawFd as _, BorrowedFd}, os::fd::{AsRawFd as _, BorrowedFd},
}; };
@ -13,7 +14,7 @@ use std::{
pub(crate) use bpf::*; pub(crate) use bpf::*;
#[cfg(test)] #[cfg(test)]
pub(crate) use fake::*; pub(crate) use fake::*;
use libc::{c_int, c_long, pid_t, SYS_bpf, SYS_perf_event_open}; use libc::{pid_t, SYS_bpf, SYS_perf_event_open};
#[doc(hidden)] #[doc(hidden)]
pub use netlink::netlink_set_link_up; pub use netlink::netlink_set_link_up;
pub(crate) use netlink::*; pub(crate) use netlink::*;

@ -1,10 +1,10 @@
use std::{ use std::{
ffi::{c_long, CString, OsStr}, ffi::{c_int, c_long, CString, OsStr},
io, mem, io, mem,
os::fd::{BorrowedFd, FromRawFd as _, OwnedFd}, os::fd::{BorrowedFd, FromRawFd as _, OwnedFd},
}; };
use libc::{c_int, pid_t}; use libc::pid_t;
use super::{syscall, SysResult, Syscall}; use super::{syscall, SysResult, Syscall};
use crate::generated::{ use crate::generated::{

@ -1219,7 +1219,7 @@ impl<T> core::convert::From<T> for aya::maps::Map
pub fn aya::maps::Map::from(t: T) -> T pub fn aya::maps::Map::from(t: T) -> T
pub enum aya::maps::MapError pub enum aya::maps::MapError
pub aya::maps::MapError::CreateError pub aya::maps::MapError::CreateError
pub aya::maps::MapError::CreateError::code: libc::unix::linux_like::linux::gnu::b64::x86_64::not_x32::c_long pub aya::maps::MapError::CreateError::code: core::ffi::c_long
pub aya::maps::MapError::CreateError::io_error: std::io::error::Error pub aya::maps::MapError::CreateError::io_error: std::io::error::Error
pub aya::maps::MapError::CreateError::name: alloc::string::String pub aya::maps::MapError::CreateError::name: alloc::string::String
pub aya::maps::MapError::ElementNotFound pub aya::maps::MapError::ElementNotFound

Loading…
Cancel
Save