From b43065f0c5cea5420f514cddde3773cf813ca288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Wed, 8 Jul 2026 17:58:36 +0200 Subject: [PATCH 1/2] Add an optional zerocopy feature deriving byte-conversion traits Derives zerocopy's FromBytes, IntoBytes, KnownLayout, and Immutable on a curated allowlist of fixed-layout wire-format types (ZEROCOPY_TYPES in gen/src/main.rs) behind an off-by-default 'zerocopy' feature, so users converting stat/statx/timespec-family structs to and from byte buffers don't need hand-written unsafe or orphan-rule newtype wrappers. The derives verify no-padding/no-pointers per target at compile time, so the allowlist is self-policing: an unsound addition fails the build. CI gains a job checking the feature across a width- and endianness-diverse target set. --- .github/workflows/main.yml | 40 ++++++++++++++ Cargo.toml | 5 +- README.md | 9 ++++ gen/src/main.rs | 105 +++++++++++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c98ea812a..1beab9527 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 830fe688f..41b88570c 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] diff --git a/README.md b/README.md index b44ef22e7..3cefb90fd 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 965458ebd..dbc55643b 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 { From 85378cd350c6060697cd9c128933b83075815bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Wed, 8 Jul 2026 18:20:02 +0200 Subject: [PATCH 2/2] Regenerate with the zerocopy derives Output of gen with the ZEROCOPY_TYPES callback: cfg_attr'd derive lines on the allowlisted wire-format structs, per the architecture exceptions, plus the generated 'zerocopy' feature line. Verified with 'cargo check --features zerocopy' (via -Zbuild-std=core where no prebuilt core exists) for every architecture except csky, m68k, and mips32r6, whose toolchains currently can't build the crate at all (csky) or core itself (m68k SIGSEGV, mips32r6 SIGILL); those three received conservative exceptions. --- Cargo.toml | 1 + src/aarch64/general.rs | 19 +++++++++++++++++++ src/aarch64/io_uring.rs | 3 +++ src/aarch64/system.rs | 1 + src/arm/general.rs | 19 +++++++++++++++++++ src/arm/io_uring.rs | 3 +++ src/arm/system.rs | 1 + src/csky/general.rs | 18 ++++++++++++++++++ src/csky/io_uring.rs | 3 +++ src/csky/system.rs | 1 + src/hexagon/general.rs | 18 ++++++++++++++++++ src/hexagon/io_uring.rs | 3 +++ src/hexagon/system.rs | 1 + src/loongarch64/general.rs | 19 +++++++++++++++++++ src/loongarch64/io_uring.rs | 3 +++ src/loongarch64/system.rs | 1 + src/m68k/general.rs | 17 +++++++++++++++++ src/m68k/io_uring.rs | 3 +++ src/m68k/system.rs | 1 + src/mips/general.rs | 18 ++++++++++++++++++ src/mips/io_uring.rs | 3 +++ src/mips/system.rs | 1 + src/mips32r6/general.rs | 18 ++++++++++++++++++ src/mips32r6/io_uring.rs | 3 +++ src/mips32r6/system.rs | 1 + src/mips64/general.rs | 19 +++++++++++++++++++ src/mips64/io_uring.rs | 3 +++ src/mips64/system.rs | 1 + src/mips64r6/general.rs | 19 +++++++++++++++++++ src/mips64r6/io_uring.rs | 3 +++ src/mips64r6/system.rs | 1 + src/powerpc/general.rs | 17 +++++++++++++++++ src/powerpc/io_uring.rs | 3 +++ src/powerpc/system.rs | 1 + src/powerpc64/general.rs | 18 ++++++++++++++++++ src/powerpc64/io_uring.rs | 3 +++ src/powerpc64/system.rs | 1 + src/riscv32/general.rs | 18 ++++++++++++++++++ src/riscv32/io_uring.rs | 3 +++ src/riscv32/system.rs | 1 + src/riscv64/general.rs | 19 +++++++++++++++++++ src/riscv64/io_uring.rs | 3 +++ src/riscv64/system.rs | 1 + src/s390x/general.rs | 19 +++++++++++++++++++ src/s390x/io_uring.rs | 3 +++ src/s390x/system.rs | 1 + src/sparc/general.rs | 17 +++++++++++++++++ src/sparc/io_uring.rs | 3 +++ src/sparc/system.rs | 1 + src/sparc64/general.rs | 14 ++++++++++++++ src/sparc64/io_uring.rs | 2 ++ src/sparc64/system.rs | 1 + src/x32/general.rs | 17 +++++++++++++++++ src/x32/io_uring.rs | 3 +++ src/x32/system.rs | 1 + src/x86/general.rs | 20 ++++++++++++++++++++ src/x86/io_uring.rs | 3 +++ src/x86/system.rs | 1 + src/x86_64/general.rs | 20 ++++++++++++++++++++ src/x86_64/io_uring.rs | 3 +++ src/x86_64/system.rs | 1 + 61 files changed, 443 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 41b88570c..31dd1027a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,4 +61,5 @@ default = ["std", "general", "errno"] std = [] no_std = [] elf = [] +zerocopy = ["dep:zerocopy"] rustc-dep-of-std = ["core", "no_std"] diff --git a/src/aarch64/general.rs b/src/aarch64/general.rs index a95135347..ee59902bc 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 db5da5235..d2604a323 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 91e303e81..392f34f55 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 3688945fa..6e92e05d0 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 9fe580ef4..6d1a222b9 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 87e1c0a59..ef3fb4e6d 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 12691f99c..56fe8c447 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 ebcce3050..02e2265c3 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 7ed06a505..fffec7bf9 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 b08f81251..80e02b1b4 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 4fc3f1725..70ad9d04d 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 7ed06a505..fffec7bf9 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 473d1f0fd..43a09d3a7 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 0fefed607..822d15b3e 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 67f1be19f..e3614d65b 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 698b826ad..5880d08dc 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 9fe580ef4..6d1a222b9 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 87e1c0a59..ef3fb4e6d 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 4a395fa93..210774c46 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 d832f9afa..2efd82c97 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 e15e4fd7a..ed0df4b9d 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 4a395fa93..210774c46 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 d832f9afa..2efd82c97 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 e15e4fd7a..ed0df4b9d 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 aade8ffb3..a6050b28a 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 465e91974..b13e18c29 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 8015f0b31..99f0e6e3d 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 aade8ffb3..a6050b28a 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 465e91974..b13e18c29 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 8015f0b31..99f0e6e3d 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 8ad1a7a59..e2d021ae1 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 8be31991c..ba6b762f5 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 863dc9708..d9c5f5e5c 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 5cf4d958c..888534699 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 87893ffe9..4d4e08e98 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 d2df177c4..35c749a10 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 9ccb390b8..c5d0bca6c 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 b7ed64c39..379d44137 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 7ed06a505..fffec7bf9 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 59632f6ae..425dd2ce4 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 0fefed607..822d15b3e 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 67f1be19f..e3614d65b 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 196d4a587..0cfe34505 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 9ff9df5b6..4909f48a7 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 5742a223c..4937a65dc 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 e4379f189..a98cce95b 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 aa69507c1..731b6f646 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 49bc94e08..1b45eb70c 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 cc877b07b..e56784c1f 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 eb3eebe88..ffe8b7750 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 8e9b49889..f96c5d5d7 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 993970fbf..278ee067a 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 21429fc77..ce35dfc14 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 2eeaadd62..5a534acaf 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 df5e36853..38bc53834 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 25b871cac..53ebf12e5 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 87e1c0a59..ef3fb4e6d 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 2c052e7f0..25a50345b 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 465f7d6b8..1263190c7 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 b7c090587..61a7571c2 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],