diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c98ea812..1beab952 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -70,6 +70,46 @@ jobs: cargo +nightly check --tests -vv --target=hexagon-unknown-linux-musl -Zbuild-std -Zbuild-std-features=llvm-libunwind + zerocopy: + name: Zerocopy derives + runs-on: ubuntu-latest + env: + RUSTFLAGS: -D warnings + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: ./.github/actions/install-rust + with: + toolchain: stable + - run: > + rustup target add + x86_64-unknown-linux-musl + x86_64-unknown-linux-gnux32 + i686-unknown-linux-gnu + riscv64gc-unknown-linux-gnu + aarch64-unknown-linux-gnu + powerpc64le-unknown-linux-gnu + armv5te-unknown-linux-gnueabi + loongarch64-unknown-linux-gnu + s390x-unknown-linux-gnu + - run: | + # The derives are compile-time verified per target (padding differs + # by architecture), so check a width- and endianness-diverse set. + for target in \ + x86_64-unknown-linux-gnu \ + x86_64-unknown-linux-musl \ + x86_64-unknown-linux-gnux32 \ + i686-unknown-linux-gnu \ + riscv64gc-unknown-linux-gnu \ + aarch64-unknown-linux-gnu \ + powerpc64le-unknown-linux-gnu \ + armv5te-unknown-linux-gnueabi \ + loongarch64-unknown-linux-gnu \ + s390x-unknown-linux-gnu; do + cargo check --features zerocopy --target=$target + done + gen: name: Update generated files runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 830fe688..31dd1027 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,13 +14,16 @@ rust-version = "1.63" [dependencies] core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } +# Optional: compile-time-verified byte-conversion derives on the fixed-layout +# wire-format types (see `ZEROCOPY_TYPES` in gen/src/main.rs). +zerocopy = { version = "0.8.0", optional = true, default-features = false, features = ["derive"] } [dev-dependencies] static_assertions = "1.1.0" libc = "0.2.100" [package.metadata.docs.rs] -features = ["default", "bootparam", "btrfs", "elf_uapi", "image", "ioctl", "landlock", "netlink", "io_uring", "if_arp", "if_ether", "if_packet", "net", "ptrace", "prctl", "elf", "xdp", "mempolicy", "system", "loop_device"] +features = ["default", "bootparam", "btrfs", "elf_uapi", "image", "ioctl", "landlock", "netlink", "io_uring", "if_arp", "if_ether", "if_packet", "net", "ptrace", "prctl", "elf", "xdp", "mempolicy", "system", "loop_device", "zerocopy"] targets = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"] [lints.rust.unexpected_cfgs] @@ -58,4 +61,5 @@ default = ["std", "general", "errno"] std = [] no_std = [] elf = [] +zerocopy = ["dep:zerocopy"] rustc-dep-of-std = ["core", "no_std"] diff --git a/README.md b/README.md index b44ef22e..3cefb90f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,15 @@ The full bindings are quite large, so they've been split up into modules and cargo features. By default, `general` and `errno` are enabled, which provide most things needed by general-purpose code. +The optional `zerocopy` feature adds compile-time-verified [zerocopy] trait +derives (`FromBytes`, `IntoBytes`, `KnownLayout`, `Immutable`) to a curated +set of fixed-layout wire-format types (`stat`, `statx`, `rusage`, +`timespec`, …), so they can be converted to and from byte buffers without +hand-written `unsafe`. See `ZEROCOPY_TYPES` in `gen/src/main.rs` for the +list and the criteria for adding to it. + +[zerocopy]: https://crates.io/crates/zerocopy + To regenerate the generated bindings, run `cargo update && cd gen && cargo run --release`. ## Similar crates diff --git a/gen/src/main.rs b/gen/src/main.rs index 965458eb..dbc55643 100644 --- a/gen/src/main.rs +++ b/gen/src/main.rs @@ -1,6 +1,7 @@ //! A program which generates a linux-headers installation and runs bindgen //! over the headers, for each supported architecture. +use bindgen::callbacks::{AttributeInfo, ParseCallbacks, TypeKind}; use bindgen::{builder, EnumVariation}; use std::collections::HashSet; use std::fs::File; @@ -15,6 +16,106 @@ const LINUX_VERSION: &str = "v6.17"; /// Some commonly used features. const DEFAULT_FEATURES: &str = "\"general\", \"errno\""; +/// Fixed-layout wire-format types that receive `zerocopy` trait derives +/// under the optional `zerocopy` feature, so users can safely convert them +/// to and from byte buffers without hand-written `unsafe`. +/// +/// A type belongs here only if, on every supported architecture, it has no +/// pointer, enum, or union fields and no implicit padding — `zerocopy`'s +/// derives verify all of that at compile time, so an unsound addition fails +/// the build rather than compiling into UB. +const ZEROCOPY_TYPES: &[&str] = &[ + "__kernel_fsid_t", + "__kernel_itimerspec", + "__kernel_old_timeval", + "__kernel_timespec", + "epoll_event", + "itimerspec", + "itimerval", + "new_utsname", + "pollfd", + "rlimit", + "rlimit64", + "rusage", + "stat", + "statfs", + "statfs64", + "statx", + "statx_timestamp", + "timespec", + "timeval", + "timezone", + "winsize", +]; + +/// Architectures on which a [`ZEROCOPY_TYPES`] entry does *not* get the +/// derives: the type has implicit padding there (`IntoBytes` would reject +/// it — e.g. `epoll_event` is `__EPOLL_PACKED` only on x86-family), or a +/// field type is excluded. Verified empirically by compiling the feature +/// for every architecture; entries for csky, m68k, and mips32r6 are +/// conservative because their toolchains can't currently build core (a +/// missing derive is never unsound, just unavailable). +const ZEROCOPY_ARCH_EXCEPTIONS: &[(&str, &[&str])] = &[ + ( + "epoll_event", + &[ + "aarch64", + "arm", + "csky", + "hexagon", + "loongarch64", + "m68k", + "mips", + "mips32r6", + "mips64", + "mips64r6", + "powerpc", + "powerpc64", + "riscv32", + "riscv64", + "s390x", + "sparc", + "sparc64", + ], + ), + ( + "statfs64", + &[ + "csky", "hexagon", "m68k", "mips", "mips32r6", "powerpc", "riscv32", "sparc", "x32", + ], + ), + ("stat", &["m68k", "powerpc", "powerpc64", "sparc", "sparc64"]), + ("timespec", &["x32"]), + ("itimerspec", &["x32"]), // contains timespec + ("timeval", &["sparc64"]), + ("__kernel_old_timeval", &["sparc64"]), + ("itimerval", &["sparc64"]), // contains timeval + ("rusage", &["sparc64"]), // contains __kernel_old_timeval +]; + +/// Adds `zerocopy` derives (feature-gated) to the types in +/// [`ZEROCOPY_TYPES`], per the architecture exceptions above. +#[derive(Debug)] +struct ZerocopyDerives { + arch: String, +} + +impl ParseCallbacks for ZerocopyDerives { + fn add_attributes(&self, info: &AttributeInfo<'_>) -> Vec { + let excepted = ZEROCOPY_ARCH_EXCEPTIONS + .iter() + .any(|(name, arches)| *name == info.name && arches.contains(&self.arch.as_str())); + if info.kind == TypeKind::Struct && ZEROCOPY_TYPES.contains(&info.name) && !excepted { + vec![ + "#[cfg_attr(feature = \"zerocopy\", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))]" + .to_owned(), + ] + } else { + vec![] + } + } +} + fn main() { let mut args = env::args(); let _exe = args.next().unwrap(); @@ -174,6 +275,7 @@ fn main() { writeln!(cargo_toml, "std = []").unwrap(); writeln!(cargo_toml, "no_std = []").unwrap(); writeln!(cargo_toml, "elf = []").unwrap(); + writeln!(cargo_toml, "zerocopy = [\"dep:zerocopy\"]").unwrap(); writeln!(cargo_toml, "rustc-dep-of-std = [\"core\", \"no_std\"]").unwrap(); eprintln!("All bindings generated!"); @@ -320,6 +422,9 @@ fn run_bindgen( // The generated bindings are quite large, so use a few simple options // to keep the file sizes down. .rustfmt_configuration_file(Some(Path::new("bindgen-rustfmt.toml").to_owned())) + .parse_callbacks(Box::new(ZerocopyDerives { + arch: rust_arch.to_owned(), + })) .layout_tests(false) .generate_comments(false) .default_enum_style(EnumVariation::Rust { diff --git a/src/aarch64/general.rs b/src/aarch64/general.rs index a9513534..ee59902b 100644 --- a/src/aarch64/general.rs +++ b/src/aarch64/general.rs @@ -82,6 +82,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -478,6 +479,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -500,18 +502,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -536,6 +541,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -556,12 +562,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -699,6 +707,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -706,6 +715,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -775,6 +785,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -793,30 +804,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -966,6 +982,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -990,6 +1007,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1006,6 +1024,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/aarch64/io_uring.rs b/src/aarch64/io_uring.rs index db5da523..d2604a32 100644 --- a/src/aarch64/io_uring.rs +++ b/src/aarch64/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/aarch64/system.rs b/src/aarch64/system.rs index 91e303e8..392f34f5 100644 --- a/src/aarch64/system.rs +++ b/src/aarch64/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/arm/general.rs b/src/arm/general.rs index 3688945f..6e92e05d 100644 --- a/src/arm/general.rs +++ b/src/arm/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -476,6 +477,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -498,18 +500,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -534,6 +539,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -554,12 +560,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -692,6 +700,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -699,6 +708,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -768,6 +778,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -786,30 +797,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -974,6 +990,7 @@ pub st_ctime: crate::ctypes::c_ulong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1019,6 +1036,7 @@ pub st_ino: crate::ctypes::c_ulonglong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, @@ -1035,6 +1053,7 @@ pub f_spare: [__u32; 4usize], } #[repr(C, packed(4))] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/arm/io_uring.rs b/src/arm/io_uring.rs index 9fe580ef..6d1a222b 100644 --- a/src/arm/io_uring.rs +++ b/src/arm/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/arm/system.rs b/src/arm/system.rs index 87e1c0a5..ef3fb4e6 100644 --- a/src/arm/system.rs +++ b/src/arm/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/csky/general.rs b/src/csky/general.rs index 12691f99..56fe8c44 100644 --- a/src/csky/general.rs +++ b/src/csky/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -476,6 +477,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -498,18 +500,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -534,6 +539,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -554,12 +560,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -697,6 +705,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -704,6 +713,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -773,6 +783,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -791,30 +802,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -965,6 +981,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1013,6 +1030,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/csky/io_uring.rs b/src/csky/io_uring.rs index ebcce305..02e2265c 100644 --- a/src/csky/io_uring.rs +++ b/src/csky/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/csky/system.rs b/src/csky/system.rs index 7ed06a50..fffec7bf 100644 --- a/src/csky/system.rs +++ b/src/csky/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/hexagon/general.rs b/src/hexagon/general.rs index b08f8125..80e02b1b 100644 --- a/src/hexagon/general.rs +++ b/src/hexagon/general.rs @@ -85,6 +85,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -481,6 +482,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -503,18 +505,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -539,6 +544,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -559,12 +565,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -701,6 +709,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -708,6 +717,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -777,6 +787,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -795,30 +806,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -968,6 +984,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1016,6 +1033,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/hexagon/io_uring.rs b/src/hexagon/io_uring.rs index 4fc3f172..70ad9d04 100644 --- a/src/hexagon/io_uring.rs +++ b/src/hexagon/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/hexagon/system.rs b/src/hexagon/system.rs index 7ed06a50..fffec7bf 100644 --- a/src/hexagon/system.rs +++ b/src/hexagon/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/loongarch64/general.rs b/src/loongarch64/general.rs index 473d1f0f..43a09d3a 100644 --- a/src/loongarch64/general.rs +++ b/src/loongarch64/general.rs @@ -82,6 +82,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -478,6 +479,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -500,18 +502,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -536,6 +541,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -556,12 +562,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -698,6 +706,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -705,6 +714,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -774,6 +784,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -792,30 +803,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -965,6 +981,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -989,6 +1006,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1005,6 +1023,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/loongarch64/io_uring.rs b/src/loongarch64/io_uring.rs index 0fefed60..822d15b3 100644 --- a/src/loongarch64/io_uring.rs +++ b/src/loongarch64/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/loongarch64/system.rs b/src/loongarch64/system.rs index 67f1be19..e3614d65 100644 --- a/src/loongarch64/system.rs +++ b/src/loongarch64/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/m68k/general.rs b/src/m68k/general.rs index 698b826a..5880d08d 100644 --- a/src/m68k/general.rs +++ b/src/m68k/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -476,6 +477,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -498,18 +500,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -534,6 +539,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -554,12 +560,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -692,6 +700,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -699,6 +708,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -768,6 +778,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -786,30 +797,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -1021,6 +1037,7 @@ pub st_ino: crate::ctypes::c_ulonglong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/m68k/io_uring.rs b/src/m68k/io_uring.rs index 9fe580ef..6d1a222b 100644 --- a/src/m68k/io_uring.rs +++ b/src/m68k/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/m68k/system.rs b/src/m68k/system.rs index 87e1c0a5..ef3fb4e6 100644 --- a/src/m68k/system.rs +++ b/src/m68k/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/mips/general.rs b/src/mips/general.rs index 4a395fa9..210774c4 100644 --- a/src/mips/general.rs +++ b/src/mips/general.rs @@ -81,6 +81,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -479,6 +480,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -501,18 +503,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -537,6 +542,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -557,12 +563,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -699,6 +707,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -706,6 +715,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -804,6 +814,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -822,30 +833,35 @@ pub c_cc: [crate::ctypes::c_uchar; 23usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -995,6 +1011,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_uint, pub st_pad1: [crate::ctypes::c_long; 3usize], @@ -1042,6 +1059,7 @@ pub st_blocks: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, diff --git a/src/mips/io_uring.rs b/src/mips/io_uring.rs index d832f9af..2efd82c9 100644 --- a/src/mips/io_uring.rs +++ b/src/mips/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/mips/system.rs b/src/mips/system.rs index e15e4fd7..ed0df4b9 100644 --- a/src/mips/system.rs +++ b/src/mips/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/mips32r6/general.rs b/src/mips32r6/general.rs index 4a395fa9..210774c4 100644 --- a/src/mips32r6/general.rs +++ b/src/mips32r6/general.rs @@ -81,6 +81,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -479,6 +480,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -501,18 +503,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -537,6 +542,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -557,12 +563,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -699,6 +707,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -706,6 +715,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -804,6 +814,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -822,30 +833,35 @@ pub c_cc: [crate::ctypes::c_uchar; 23usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -995,6 +1011,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_uint, pub st_pad1: [crate::ctypes::c_long; 3usize], @@ -1042,6 +1059,7 @@ pub st_blocks: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, diff --git a/src/mips32r6/io_uring.rs b/src/mips32r6/io_uring.rs index d832f9af..2efd82c9 100644 --- a/src/mips32r6/io_uring.rs +++ b/src/mips32r6/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/mips32r6/system.rs b/src/mips32r6/system.rs index e15e4fd7..ed0df4b9 100644 --- a/src/mips32r6/system.rs +++ b/src/mips32r6/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/mips64/general.rs b/src/mips64/general.rs index aade8ffb..a6050b28 100644 --- a/src/mips64/general.rs +++ b/src/mips64/general.rs @@ -83,6 +83,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -479,6 +480,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -501,18 +503,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -537,6 +542,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -557,12 +563,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -699,6 +707,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -706,6 +715,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -804,6 +814,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -822,30 +833,35 @@ pub c_cc: [crate::ctypes::c_uchar; 23usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -995,6 +1011,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_uint, pub st_pad0: [crate::ctypes::c_uint; 3usize], @@ -1018,6 +1035,7 @@ pub st_blocks: crate::ctypes::c_ulong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, @@ -1034,6 +1052,7 @@ pub f_spare: [crate::ctypes::c_long; 5usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, diff --git a/src/mips64/io_uring.rs b/src/mips64/io_uring.rs index 465e9197..b13e18c2 100644 --- a/src/mips64/io_uring.rs +++ b/src/mips64/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/mips64/system.rs b/src/mips64/system.rs index 8015f0b3..99f0e6e3 100644 --- a/src/mips64/system.rs +++ b/src/mips64/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/mips64r6/general.rs b/src/mips64r6/general.rs index aade8ffb..a6050b28 100644 --- a/src/mips64r6/general.rs +++ b/src/mips64r6/general.rs @@ -83,6 +83,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -479,6 +480,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -501,18 +503,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -537,6 +542,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -557,12 +563,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -699,6 +707,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -706,6 +715,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -804,6 +814,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -822,30 +833,35 @@ pub c_cc: [crate::ctypes::c_uchar; 23usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -995,6 +1011,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_uint, pub st_pad0: [crate::ctypes::c_uint; 3usize], @@ -1018,6 +1035,7 @@ pub st_blocks: crate::ctypes::c_ulong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, @@ -1034,6 +1052,7 @@ pub f_spare: [crate::ctypes::c_long; 5usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: crate::ctypes::c_long, pub f_bsize: crate::ctypes::c_long, diff --git a/src/mips64r6/io_uring.rs b/src/mips64r6/io_uring.rs index 465e9197..b13e18c2 100644 --- a/src/mips64r6/io_uring.rs +++ b/src/mips64r6/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/mips64r6/system.rs b/src/mips64r6/system.rs index 8015f0b3..99f0e6e3 100644 --- a/src/mips64r6/system.rs +++ b/src/mips64r6/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/powerpc/general.rs b/src/powerpc/general.rs index 8ad1a7a5..e2d021ae 100644 --- a/src/powerpc/general.rs +++ b/src/powerpc/general.rs @@ -87,6 +87,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -483,6 +484,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -505,18 +507,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -541,6 +546,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -561,12 +567,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -718,6 +726,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -725,6 +734,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -813,6 +823,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -831,30 +842,35 @@ pub c_cc: [crate::ctypes::c_uchar; 10usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -1064,6 +1080,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/powerpc/io_uring.rs b/src/powerpc/io_uring.rs index 8be31991..ba6b762f 100644 --- a/src/powerpc/io_uring.rs +++ b/src/powerpc/io_uring.rs @@ -326,18 +326,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/powerpc/system.rs b/src/powerpc/system.rs index 863dc970..d9c5f5e5 100644 --- a/src/powerpc/system.rs +++ b/src/powerpc/system.rs @@ -92,6 +92,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/powerpc64/general.rs b/src/powerpc64/general.rs index 5cf4d958..88853469 100644 --- a/src/powerpc64/general.rs +++ b/src/powerpc64/general.rs @@ -89,6 +89,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -485,6 +486,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -507,18 +509,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -543,6 +548,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -563,12 +569,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -714,6 +722,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -721,6 +730,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -809,6 +819,7 @@ pub t_lnextc: crate::ctypes::c_char, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -827,30 +838,35 @@ pub c_cc: [crate::ctypes::c_uchar; 10usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -1046,6 +1062,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1062,6 +1079,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/powerpc64/io_uring.rs b/src/powerpc64/io_uring.rs index 87893ffe..4d4e08e9 100644 --- a/src/powerpc64/io_uring.rs +++ b/src/powerpc64/io_uring.rs @@ -328,18 +328,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/powerpc64/system.rs b/src/powerpc64/system.rs index d2df177c..35c749a1 100644 --- a/src/powerpc64/system.rs +++ b/src/powerpc64/system.rs @@ -97,6 +97,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/riscv32/general.rs b/src/riscv32/general.rs index 9ccb390b..c5d0bca6 100644 --- a/src/riscv32/general.rs +++ b/src/riscv32/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -476,6 +477,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -498,18 +500,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -534,6 +539,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -554,12 +560,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -696,6 +704,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -703,6 +712,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -772,6 +782,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -790,30 +801,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -963,6 +979,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1011,6 +1028,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/riscv32/io_uring.rs b/src/riscv32/io_uring.rs index b7ed64c3..379d4413 100644 --- a/src/riscv32/io_uring.rs +++ b/src/riscv32/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/riscv32/system.rs b/src/riscv32/system.rs index 7ed06a50..fffec7bf 100644 --- a/src/riscv32/system.rs +++ b/src/riscv32/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/riscv64/general.rs b/src/riscv64/general.rs index 59632f6a..425dd2ce 100644 --- a/src/riscv64/general.rs +++ b/src/riscv64/general.rs @@ -82,6 +82,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -478,6 +479,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -500,18 +502,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -536,6 +541,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -556,12 +562,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -698,6 +706,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -705,6 +714,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -774,6 +784,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -792,30 +803,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -965,6 +981,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -989,6 +1006,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1005,6 +1023,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/riscv64/io_uring.rs b/src/riscv64/io_uring.rs index 0fefed60..822d15b3 100644 --- a/src/riscv64/io_uring.rs +++ b/src/riscv64/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/riscv64/system.rs b/src/riscv64/system.rs index 67f1be19..e3614d65 100644 --- a/src/riscv64/system.rs +++ b/src/riscv64/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/s390x/general.rs b/src/s390x/general.rs index 196d4a58..0cfe3450 100644 --- a/src/s390x/general.rs +++ b/src/s390x/general.rs @@ -97,6 +97,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -493,6 +494,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -515,18 +517,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -551,6 +556,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -571,12 +577,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -598,30 +606,35 @@ pub cgroup: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -744,6 +757,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -751,6 +765,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -820,6 +835,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -981,6 +997,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1003,6 +1020,7 @@ pub __unused: [crate::ctypes::c_ulong; 3usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: crate::ctypes::c_uint, pub f_bsize: crate::ctypes::c_uint, @@ -1019,6 +1037,7 @@ pub f_spare: [crate::ctypes::c_uint; 5usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: crate::ctypes::c_uint, pub f_bsize: crate::ctypes::c_uint, diff --git a/src/s390x/io_uring.rs b/src/s390x/io_uring.rs index 9ff9df5b..4909f48a 100644 --- a/src/s390x/io_uring.rs +++ b/src/s390x/io_uring.rs @@ -336,18 +336,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/s390x/system.rs b/src/s390x/system.rs index 5742a223..4937a65d 100644 --- a/src/s390x/system.rs +++ b/src/s390x/system.rs @@ -105,6 +105,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/sparc/general.rs b/src/sparc/general.rs index e4379f18..a98cce95 100644 --- a/src/sparc/general.rs +++ b/src/sparc/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -478,6 +479,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -500,18 +502,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -536,6 +541,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -556,12 +562,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -713,6 +721,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -720,6 +729,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -789,6 +799,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -807,30 +818,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -1025,6 +1041,7 @@ pub __unused5: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/sparc/io_uring.rs b/src/sparc/io_uring.rs index aa69507c..731b6f64 100644 --- a/src/sparc/io_uring.rs +++ b/src/sparc/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/sparc/system.rs b/src/sparc/system.rs index 49bc94e0..1b45eb70 100644 --- a/src/sparc/system.rs +++ b/src/sparc/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/sparc64/general.rs b/src/sparc64/general.rs index cc877b07..e56784c1 100644 --- a/src/sparc64/general.rs +++ b/src/sparc64/general.rs @@ -88,6 +88,7 @@ pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -486,6 +487,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -508,12 +510,14 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, @@ -558,12 +562,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -715,6 +721,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -722,6 +729,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -791,6 +799,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -809,6 +818,7 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, @@ -821,6 +831,7 @@ pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, @@ -833,6 +844,7 @@ pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -1022,6 +1034,7 @@ pub __unused: [crate::ctypes::c_long; 3usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1038,6 +1051,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/sparc64/io_uring.rs b/src/sparc64/io_uring.rs index eb3eebe8..ffe8b775 100644 --- a/src/sparc64/io_uring.rs +++ b/src/sparc64/io_uring.rs @@ -328,12 +328,14 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, diff --git a/src/sparc64/system.rs b/src/sparc64/system.rs index 8e9b4988..f96c5d5d 100644 --- a/src/sparc64/system.rs +++ b/src/sparc64/system.rs @@ -97,6 +97,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/x32/general.rs b/src/x32/general.rs index 993970fb..278ee067 100644 --- a/src/x32/general.rs +++ b/src/x32/general.rs @@ -83,6 +83,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -157,6 +158,7 @@ pub resolve: __u64, } #[repr(C, packed)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct epoll_event { pub events: __poll_t, pub data: __u64, @@ -479,6 +481,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -501,18 +504,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -537,6 +543,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -557,12 +564,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -696,6 +705,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -703,6 +713,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -772,6 +783,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -796,6 +808,7 @@ pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, @@ -808,12 +821,14 @@ pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -963,6 +978,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: __kernel_ulong_t, pub st_ino: __kernel_ulong_t, @@ -1000,6 +1016,7 @@ pub st_ctime: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/x32/io_uring.rs b/src/x32/io_uring.rs index 21429fc7..ce35dfc1 100644 --- a/src/x32/io_uring.rs +++ b/src/x32/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/x32/system.rs b/src/x32/system.rs index 2eeaadd6..5a534aca 100644 --- a/src/x32/system.rs +++ b/src/x32/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/x86/general.rs b/src/x86/general.rs index df5e3685..38bc5383 100644 --- a/src/x86/general.rs +++ b/src/x86/general.rs @@ -80,6 +80,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 32usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -154,6 +155,7 @@ pub resolve: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct epoll_event { pub events: __poll_t, pub data: __u64, @@ -476,6 +478,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -498,18 +501,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -534,6 +540,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -554,12 +561,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -693,6 +702,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -700,6 +710,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -769,6 +780,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -787,30 +799,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -961,6 +978,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: crate::ctypes::c_ulong, pub st_ino: crate::ctypes::c_ulong, @@ -1021,6 +1039,7 @@ pub st_ctime: crate::ctypes::c_ulong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __u32, pub f_bsize: __u32, @@ -1037,6 +1056,7 @@ pub f_spare: [__u32; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __u32, pub f_bsize: __u32, diff --git a/src/x86/io_uring.rs b/src/x86/io_uring.rs index 25b871ca..53ebf12e 100644 --- a/src/x86/io_uring.rs +++ b/src/x86/io_uring.rs @@ -320,18 +320,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/x86/system.rs b/src/x86/system.rs index 87e1c0a5..ef3fb4e6 100644 --- a/src/x86/system.rs +++ b/src/x86/system.rs @@ -86,6 +86,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize], diff --git a/src/x86_64/general.rs b/src/x86_64/general.rs index 2c052e7f..25a50345 100644 --- a/src/x86_64/general.rs +++ b/src/x86_64/general.rs @@ -82,6 +82,7 @@ pub fds_bits: [crate::ctypes::c_ulong; 16usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_fsid_t { pub val: [crate::ctypes::c_int; 2usize], } @@ -156,6 +157,7 @@ pub resolve: __u64, } #[repr(C, packed)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct epoll_event { pub events: __poll_t, pub data: __u64, @@ -478,6 +480,7 @@ pub nr_recently_evicted: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct pollfd { pub fd: crate::ctypes::c_int, pub events: crate::ctypes::c_short, @@ -500,18 +503,21 @@ pub reserved: [__u32; 13usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, @@ -536,6 +542,7 @@ pub tv_usec: __s64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rusage { pub ru_utime: __kernel_old_timeval, pub ru_stime: __kernel_old_timeval, @@ -556,12 +563,14 @@ pub ru_nivcsw: __kernel_long_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit { pub rlim_cur: __kernel_ulong_t, pub rlim_max: __kernel_ulong_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct rlimit64 { pub rlim_cur: __u64, pub rlim_max: __u64, @@ -694,6 +703,7 @@ pub _attribute: *mut crate::ctypes::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx_timestamp { pub tv_sec: __s64, pub tv_nsec: __u32, @@ -701,6 +711,7 @@ pub __reserved: __s32, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statx { pub stx_mask: __u32, pub stx_blksize: __u32, @@ -770,6 +781,7 @@ pub c_ospeed: speed_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct winsize { pub ws_row: crate::ctypes::c_ushort, pub ws_col: crate::ctypes::c_ushort, @@ -788,30 +800,35 @@ pub c_cc: [crate::ctypes::c_uchar; 8usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timespec { pub tv_sec: __kernel_old_time_t, pub tv_nsec: crate::ctypes::c_long, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timeval { pub tv_sec: __kernel_old_time_t, pub tv_usec: __kernel_suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerspec { pub it_interval: timespec, pub it_value: timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct itimerval { pub it_interval: timeval, pub it_value: timeval, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct timezone { pub tz_minuteswest: crate::ctypes::c_int, pub tz_dsttime: crate::ctypes::c_int, @@ -961,6 +978,7 @@ pub d_name: __IncompleteArrayField, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct stat { pub st_dev: __kernel_ulong_t, pub st_ino: __kernel_ulong_t, @@ -998,6 +1016,7 @@ pub st_ctime: crate::ctypes::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, @@ -1014,6 +1033,7 @@ pub f_spare: [__kernel_long_t; 4usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct statfs64 { pub f_type: __kernel_long_t, pub f_bsize: __kernel_long_t, diff --git a/src/x86_64/io_uring.rs b/src/x86_64/io_uring.rs index 465f7d6b..1263190c 100644 --- a/src/x86_64/io_uring.rs +++ b/src/x86_64/io_uring.rs @@ -322,18 +322,21 @@ pub build_id_addr: __u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_timespec { pub tv_sec: __kernel_time64_t, pub tv_nsec: crate::ctypes::c_longlong, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_itimerspec { pub it_interval: __kernel_timespec, pub it_value: __kernel_timespec, } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct __kernel_old_timeval { pub tv_sec: __kernel_long_t, pub tv_usec: __kernel_long_t, diff --git a/src/x86_64/system.rs b/src/x86_64/system.rs index b7c09058..61a7571c 100644 --- a/src/x86_64/system.rs +++ b/src/x86_64/system.rs @@ -91,6 +91,7 @@ pub machine: [crate::ctypes::c_char; 65usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature = "zerocopy", derive(zerocopy::FromBytes, zerocopy::IntoBytes, zerocopy::KnownLayout, zerocopy::Immutable))] pub struct new_utsname { pub sysname: [crate::ctypes::c_char; 65usize], pub nodename: [crate::ctypes::c_char; 65usize],