mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
mesa: subprojects: remove linux-raw-sys backend and use libc
This is because Android prefers it -- the project likes to make changes to bionic that have a global effect, and using raw-syscalls potentially complicates that. This is a backport of: https://github.com/bytecodealliance/rustix/pull/1478 In addition, nothing in Mesa3D needs the added functionality provided by raw syscalls. Test: meson setup gfxstream-build -Dvulkan-drivers="gfxstream" -Dgallium-drivers="" -Dvirtgpu_kumquat=true -Dopengl=false -Drust_std=2021 still compiles. Reviewed-by: @LingMan Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36116>
This commit is contained in:
parent
475c43cf8a
commit
d978cbf944
6 changed files with 798 additions and 52 deletions
|
|
@ -53,14 +53,7 @@ if host_machine.system() == 'linux'
|
|||
required: true,
|
||||
)
|
||||
|
||||
dep_linux_raw_sys = dependency('linux-raw-sys',
|
||||
version: '>= 0.4.12',
|
||||
fallback: ['linux-raw-sys', 'dep_linux_raw_sys'],
|
||||
required: true,
|
||||
)
|
||||
|
||||
dep_mesa3d_util += [dep_rustix, dep_bitflags, dep_errno,
|
||||
dep_linux_raw_sys]
|
||||
dep_mesa3d_util += [dep_rustix, dep_bitflags, dep_errno]
|
||||
endif
|
||||
|
||||
libmesa_rust_util = static_library(
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
[wrap-file]
|
||||
directory = linux-raw-sys-0.7.0
|
||||
source_url = https://crates.io/api/v1/crates/linux-raw-sys/0.7.0/download
|
||||
source_filename = linux-raw-sys-0.7.0.tar.gz
|
||||
source_hash = 51bafc0bb5cbecb9ed381e75b803040302fd678b5d9faa04f01eaa280bc8c029
|
||||
patch_directory = linux-raw-sys
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# Copyright © 2025 Google
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
project(
|
||||
'linux-raw-sys',
|
||||
'rust',
|
||||
version : '0.7.0',
|
||||
license : 'MIT OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception',
|
||||
)
|
||||
|
||||
rust_args = [
|
||||
'--cfg', 'feature="elf"',
|
||||
'--cfg', 'feature="errno"',
|
||||
'--cfg', 'feature="general"',
|
||||
'--cfg', 'feature="if_ether"',
|
||||
'--cfg', 'feature="ioctl"',
|
||||
'--cfg', 'feature="net"',
|
||||
'--cfg', 'feature="netlink"',
|
||||
'--cfg', 'feature="no_std"',
|
||||
'--cfg', 'feature="xdp"',
|
||||
]
|
||||
|
||||
lib = static_library(
|
||||
'linux_raw_sys',
|
||||
'src/lib.rs',
|
||||
rust_args : rust_args,
|
||||
override_options : ['rust_std=2021', 'build.rust_std=2021'],
|
||||
rust_abi : 'rust',
|
||||
native : true,
|
||||
)
|
||||
|
||||
dep_linux_raw_sys = declare_dependency(
|
||||
link_with : [lib]
|
||||
)
|
||||
|
|
@ -0,0 +1,790 @@
|
|||
From bd19d4b3d439cfdf4f3882e1fe72691c0005fb9d Mon Sep 17 00:00:00 2001
|
||||
From: gurchetansingh <gurchetansingh@chromium.org>
|
||||
Date: Mon, 14 Jul 2025 08:08:17 -0700
|
||||
Subject: [PATCH] BACKPORT: rustix: on Linux, support a build without
|
||||
linux-raw-sys (#1478)
|
||||
|
||||
* rustix: on Android, support a build without linux-raw-sys
|
||||
|
||||
Rustix support was added to Mesa3D recently, but it only works
|
||||
with the linux-raw-sys backend. On Linux, even the libc
|
||||
backend, there is a dependency on linux-raw-sys for certain ABI
|
||||
definitions.
|
||||
|
||||
When updating rustix in Android to support this, I realized only
|
||||
the libc backend is supported in Android. This is because
|
||||
Android as a platform wants to discourage raw syscalls, and to
|
||||
be able to globally update libc.
|
||||
|
||||
Features like fdtrack would not work with the linux-raw-sys backend:
|
||||
|
||||
https://android.googlesource.com/platform/bionic/+/HEAD/docs/fdtrack.md
|
||||
|
||||
Given Android wants to incentize use of libc only, this MR introduces
|
||||
the concept of "linux-raw-dep". This means that linux-raw-sys is
|
||||
present as a dependency for the user. This will be on by default
|
||||
even for the libc backend, but will be turned off for Android (this
|
||||
is reflected in the build.rs script).
|
||||
|
||||
This will also help others who don't need all the features rustix
|
||||
offers on Linux, so they have one less dependency to maintain. They
|
||||
may append "--cfg=rustix_no_linux_raw" to Rust flags skip building
|
||||
the linux raw backend. Mesa3D will use this.
|
||||
|
||||
Tested via:
|
||||
|
||||
cargo build --target arm-linux-androideabi --features=use-libc,net,std,alloc,event,fs,mm,param,pipe,use-libc-auxv,libc_errno
|
||||
|
||||
and on Linux with the proper RUSTFLAGS set. The Github workflows have
|
||||
been modified to only use the current subset of features using in AOSP:
|
||||
|
||||
https://android.googlesource.com/platform/external/rust/android-crates-io/+/refs/heads/main/crates/rustix/Android.bp
|
||||
|
||||
That is the source of truth for an Android integration and the CI only
|
||||
needs to test that. Additional features may be added as needed in the
|
||||
future.
|
||||
|
||||
* rustix: fixes for Android musl build
|
||||
|
||||
Android doesn't only have a bionic toolchain, but musl
|
||||
toolchain for components built on the build workstation.
|
||||
|
||||
---------
|
||||
|
||||
Co-authored-by: Gurchetan Singh <gurchetansingh@google.com>
|
||||
---
|
||||
build.rs | 9 ++++++
|
||||
src/backend/libc/c.rs | 56 ++++++++++++++++-----------------
|
||||
src/backend/libc/fs/mod.rs | 7 +++--
|
||||
src/backend/libc/fs/syscalls.rs | 6 ++--
|
||||
src/backend/libc/io/syscalls.rs | 6 ++--
|
||||
src/backend/libc/io/types.rs | 12 +++----
|
||||
src/backend/libc/mm/types.rs | 12 +++----
|
||||
src/backend/libc/net/sockopt.rs | 6 ++--
|
||||
src/fs/constants.rs | 6 ++--
|
||||
src/fs/ioctl.rs | 8 ++---
|
||||
src/fs/mod.rs | 6 ++--
|
||||
src/fs/raw_dir.rs | 4 +++
|
||||
src/io/read_write.rs | 6 ++--
|
||||
src/ioctl/linux.rs | 4 +--
|
||||
src/ioctl/mod.rs | 2 +-
|
||||
src/net/sockopt.rs | 4 +--
|
||||
src/net/types.rs | 48 ++++++++++++++--------------
|
||||
src/timespec.rs | 2 +-
|
||||
18 files changed, 109 insertions(+), 95 deletions(-)
|
||||
|
||||
diff --git a/build.rs b/build.rs
|
||||
index d2d6541f..738492aa 100644
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -35,6 +35,10 @@ fn main() {
|
||||
// enable the libc backend even if rustix is depended on transitively.
|
||||
let cfg_use_libc = var("CARGO_CFG_RUSTIX_USE_LIBC").is_ok();
|
||||
|
||||
+ // Check for `RUSTFLAGS=--cfg=rustix_no_linux_raw`. This allows Linux users to
|
||||
+ // enable the libc backend without the linux raw dependency.
|
||||
+ let cfg_no_linux_raw = var("CARGO_CFG_RUSTIX_NO_LINUX_RAW").is_ok();
|
||||
+
|
||||
// Check for `--features=rustc-dep-of-std`.
|
||||
let rustc_dep_of_std = var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
|
||||
|
||||
@@ -103,10 +107,15 @@ fn main() {
|
||||
|| arch.starts_with("mips"))
|
||||
&& !rustix_use_experimental_asm);
|
||||
if libc {
|
||||
+ if os != "android" && os == "linux" && !cfg_no_linux_raw {
|
||||
+ use_feature("linux_raw_dep");
|
||||
+ }
|
||||
+
|
||||
// Use the libc backend.
|
||||
use_feature("libc");
|
||||
} else {
|
||||
// Use the linux_raw backend.
|
||||
+ use_feature("linux_raw_dep");
|
||||
use_feature("linux_raw");
|
||||
if rustix_use_experimental_asm {
|
||||
use_feature("asm_experimental_arch");
|
||||
diff --git a/src/backend/libc/c.rs b/src/backend/libc/c.rs
|
||||
index 2f737c21..656c4388 100644
|
||||
--- a/src/backend/libc/c.rs
|
||||
+++ b/src/backend/libc/c.rs
|
||||
@@ -19,49 +19,49 @@ pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969;
|
||||
pub(crate) const EXIT_SIGNALED_SIGABRT: c_int = 128 + SIGABRT as c_int;
|
||||
|
||||
// TODO: Upstream these.
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_TSN: c_int = linux_raw_sys::if_ether::ETH_P_TSN as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_ERSPAN2: c_int = linux_raw_sys::if_ether::ETH_P_ERSPAN2 as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_ERSPAN: c_int = linux_raw_sys::if_ether::ETH_P_ERSPAN as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_PROFINET: c_int = linux_raw_sys::if_ether::ETH_P_PROFINET as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_REALTEK: c_int = linux_raw_sys::if_ether::ETH_P_REALTEK as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_ETHERCAT: c_int = linux_raw_sys::if_ether::ETH_P_ETHERCAT as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_PREAUTH: c_int = linux_raw_sys::if_ether::ETH_P_PREAUTH as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_LLDP: c_int = linux_raw_sys::if_ether::ETH_P_LLDP as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_MRP: c_int = linux_raw_sys::if_ether::ETH_P_MRP as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_NCSI: c_int = linux_raw_sys::if_ether::ETH_P_NCSI as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_CFM: c_int = linux_raw_sys::if_ether::ETH_P_CFM as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_IBOE: c_int = linux_raw_sys::if_ether::ETH_P_IBOE as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_HSR: c_int = linux_raw_sys::if_ether::ETH_P_HSR as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_NSH: c_int = linux_raw_sys::if_ether::ETH_P_NSH as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_DSA_8021Q: c_int = linux_raw_sys::if_ether::ETH_P_DSA_8021Q as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_DSA_A5PSW: c_int = linux_raw_sys::if_ether::ETH_P_DSA_A5PSW as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_IFE: c_int = linux_raw_sys::if_ether::ETH_P_IFE as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_CAN: c_int = linux_raw_sys::if_ether::ETH_P_CAN as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_CANXL: c_int = linux_raw_sys::if_ether::ETH_P_CANXL as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_XDSA: c_int = linux_raw_sys::if_ether::ETH_P_XDSA as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_MAP: c_int = linux_raw_sys::if_ether::ETH_P_MAP as _;
|
||||
-#[cfg(all(linux_kernel, feature = "net"))]
|
||||
+#[cfg(all(linux_raw_dep, feature = "net"))]
|
||||
pub(crate) const ETH_P_MCTP: c_int = linux_raw_sys::if_ether::ETH_P_MCTP as _;
|
||||
|
||||
#[cfg(all(
|
||||
@@ -89,7 +89,7 @@ pub(crate) const MSG_DONTWAIT: c_int = MSG_NONBLOCK;
|
||||
// `O_LARGEFILE` can be automatically set by the kernel on Linux:
|
||||
// <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/open.c?h=v6.13#n1423>
|
||||
// so libc implementations may leave it undefined or defined to zero.
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
pub(crate) const O_LARGEFILE: c_int = linux_raw_sys::general::O_LARGEFILE as _;
|
||||
|
||||
// Gated under `_LARGEFILE_SOURCE` but automatically set by the kernel.
|
||||
@@ -489,7 +489,8 @@ pub(super) use readwrite_pv64v2::{preadv64v2 as preadv2, pwritev64v2 as pwritev2
|
||||
#[cfg(feature = "fs")]
|
||||
#[cfg(all(
|
||||
linux_like,
|
||||
- not(any(target_os = "android", target_os = "emscripten", target_env = "gnu"))
|
||||
+ linux_raw_dep,
|
||||
+ not(any(target_os = "emscripten", target_env = "gnu"))
|
||||
))]
|
||||
mod statx_flags {
|
||||
pub(crate) use linux_raw_sys::general::{
|
||||
@@ -507,7 +508,8 @@ mod statx_flags {
|
||||
#[cfg(feature = "fs")]
|
||||
#[cfg(all(
|
||||
linux_like,
|
||||
- not(any(target_os = "android", target_os = "emscripten", target_env = "gnu"))
|
||||
+ linux_raw_dep,
|
||||
+ not(any(target_os = "emscripten", target_env = "gnu"))
|
||||
))]
|
||||
pub(crate) use statx_flags::*;
|
||||
|
||||
@@ -515,10 +517,6 @@ pub(crate) use statx_flags::*;
|
||||
#[cfg(target_os = "android")]
|
||||
pub(crate) use __fsid_t as fsid_t;
|
||||
|
||||
-#[cfg(feature = "mm")]
|
||||
-#[cfg(target_os = "android")]
|
||||
-pub(crate) const MAP_DROPPABLE: c_int = bitcast!(linux_raw_sys::general::MAP_DROPPABLE);
|
||||
-
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
diff --git a/src/backend/libc/fs/mod.rs b/src/backend/libc/fs/mod.rs
|
||||
index 264b955c..f75c6fb7 100644
|
||||
--- a/src/backend/libc/fs/mod.rs
|
||||
+++ b/src/backend/libc/fs/mod.rs
|
||||
@@ -16,9 +16,12 @@ pub(crate) mod syscalls;
|
||||
pub(crate) mod types;
|
||||
|
||||
// TODO: Fix linux-raw-sys to define ioctl codes for sparc.
|
||||
-#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
|
||||
+#[cfg(all(linux_raw_dep, any(target_arch = "sparc", target_arch = "sparc64")))]
|
||||
pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::Opcode = 0x8008_6610;
|
||||
|
||||
-#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
|
||||
+#[cfg(all(
|
||||
+ linux_raw_dep,
|
||||
+ not(any(target_arch = "sparc", target_arch = "sparc64"))
|
||||
+))]
|
||||
pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::Opcode =
|
||||
linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS as crate::ioctl::Opcode;
|
||||
diff --git a/src/backend/libc/fs/syscalls.rs b/src/backend/libc/fs/syscalls.rs
|
||||
index f2ac4f73..ef1033cc 100644
|
||||
--- a/src/backend/libc/fs/syscalls.rs
|
||||
+++ b/src/backend/libc/fs/syscalls.rs
|
||||
@@ -1840,7 +1840,7 @@ pub(crate) fn memfd_create(name: &CStr, flags: MemfdFlags) -> io::Result<OwnedFd
|
||||
unsafe { ret_owned_fd(memfd_create(c_str(name), bitflags_bits!(flags))) }
|
||||
}
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
pub(crate) fn openat2(
|
||||
dirfd: BorrowedFd<'_>,
|
||||
path: &CStr,
|
||||
@@ -2053,9 +2053,9 @@ pub(crate) fn statx(
|
||||
// doesn't represent all the known flags.
|
||||
//
|
||||
// [it's deprecated]: https://patchwork.kernel.org/project/linux-fsdevel/patch/20200505095915.11275-7-mszeredi@redhat.com/
|
||||
- #[cfg(not(any(target_os = "android", target_env = "musl")))]
|
||||
+ #[cfg(any(not(linux_raw_dep), not(target_env = "musl")))]
|
||||
const STATX__RESERVED: u32 = c::STATX__RESERVED as u32;
|
||||
- #[cfg(any(target_os = "android", target_env = "musl"))]
|
||||
+ #[cfg(target_env = "musl")]
|
||||
const STATX__RESERVED: u32 = linux_raw_sys::general::STATX__RESERVED;
|
||||
if (mask.bits() & STATX__RESERVED) == STATX__RESERVED {
|
||||
return Err(io::Errno::INVAL);
|
||||
diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs
|
||||
index f1231aaf..d91e983c 100644
|
||||
--- a/src/backend/libc/io/syscalls.rs
|
||||
+++ b/src/backend/libc/io/syscalls.rs
|
||||
@@ -13,7 +13,7 @@ use crate::fd::{AsFd as _, BorrowedFd, OwnedFd, RawFd};
|
||||
target_os = "wasi"
|
||||
)))]
|
||||
use crate::io::DupFlags;
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
use crate::io::ReadWriteFlags;
|
||||
use crate::io::{self, FdFlags};
|
||||
use crate::ioctl::{IoctlOutput, Opcode};
|
||||
@@ -150,7 +150,7 @@ pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>], offset: u64) ->
|
||||
}
|
||||
}
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
pub(crate) fn preadv2(
|
||||
fd: BorrowedFd<'_>,
|
||||
bufs: &mut [IoSliceMut<'_>],
|
||||
@@ -170,7 +170,7 @@ pub(crate) fn preadv2(
|
||||
}
|
||||
}
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
pub(crate) fn pwritev2(
|
||||
fd: BorrowedFd<'_>,
|
||||
bufs: &[IoSlice<'_>],
|
||||
diff --git a/src/backend/libc/io/types.rs b/src/backend/libc/io/types.rs
|
||||
index 510206f9..b434b68a 100644
|
||||
--- a/src/backend/libc/io/types.rs
|
||||
+++ b/src/backend/libc/io/types.rs
|
||||
@@ -17,7 +17,7 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
bitflags! {
|
||||
/// `RWF_*` constants for use with [`preadv2`] and [`pwritev2`].
|
||||
///
|
||||
@@ -27,15 +27,15 @@ bitflags! {
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
||||
pub struct ReadWriteFlags: u32 {
|
||||
/// `RWF_DSYNC` (since Linux 4.7)
|
||||
- const DSYNC = linux_raw_sys::general::RWF_DSYNC;
|
||||
+ const DSYNC = libc::RWF_DSYNC as u32;
|
||||
/// `RWF_HIPRI` (since Linux 4.6)
|
||||
- const HIPRI = linux_raw_sys::general::RWF_HIPRI;
|
||||
+ const HIPRI = libc::RWF_HIPRI as u32;
|
||||
/// `RWF_SYNC` (since Linux 4.7)
|
||||
- const SYNC = linux_raw_sys::general::RWF_SYNC;
|
||||
+ const SYNC = libc::RWF_SYNC as u32;
|
||||
/// `RWF_NOWAIT` (since Linux 4.14)
|
||||
- const NOWAIT = linux_raw_sys::general::RWF_NOWAIT;
|
||||
+ const NOWAIT = libc::RWF_NOWAIT as u32;
|
||||
/// `RWF_APPEND` (since Linux 4.16)
|
||||
- const APPEND = linux_raw_sys::general::RWF_APPEND;
|
||||
+ const APPEND = libc::RWF_APPEND as u32;
|
||||
|
||||
/// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
|
||||
const _ = !0;
|
||||
diff --git a/src/backend/libc/mm/types.rs b/src/backend/libc/mm/types.rs
|
||||
index 0b99e3c4..6f7d24f5 100644
|
||||
--- a/src/backend/libc/mm/types.rs
|
||||
+++ b/src/backend/libc/mm/types.rs
|
||||
@@ -44,19 +44,19 @@ bitflags! {
|
||||
#[cfg(linux_kernel)]
|
||||
const GROWSDOWN = bitcast!(c::PROT_GROWSDOWN);
|
||||
/// `PROT_SEM`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
const SEM = linux_raw_sys::general::PROT_SEM;
|
||||
/// `PROT_BTI`
|
||||
- #[cfg(all(linux_kernel, target_arch = "aarch64"))]
|
||||
+ #[cfg(all(linux_raw_dep, target_arch = "aarch64"))]
|
||||
const BTI = linux_raw_sys::general::PROT_BTI;
|
||||
/// `PROT_MTE`
|
||||
- #[cfg(all(linux_kernel, target_arch = "aarch64"))]
|
||||
+ #[cfg(all(linux_raw_dep, target_arch = "aarch64"))]
|
||||
const MTE = linux_raw_sys::general::PROT_MTE;
|
||||
/// `PROT_SAO`
|
||||
- #[cfg(all(linux_kernel, any(target_arch = "powerpc", target_arch = "powerpc64")))]
|
||||
+ #[cfg(all(linux_raw_dep, any(target_arch = "powerpc", target_arch = "powerpc64")))]
|
||||
const SAO = linux_raw_sys::general::PROT_SAO;
|
||||
/// `PROT_ADI`
|
||||
- #[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
|
||||
+ #[cfg(all(linux_raw_dep, any(target_arch = "sparc", target_arch = "sparc64")))]
|
||||
const ADI = linux_raw_sys::general::PROT_ADI;
|
||||
|
||||
/// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
|
||||
@@ -252,7 +252,7 @@ bitflags! {
|
||||
#[cfg(any())]
|
||||
const UNINITIALIZED = bitcast!(c::MAP_UNINITIALIZED);
|
||||
/// `MAP_DROPPABLE`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
const DROPPABLE = bitcast!(c::MAP_DROPPABLE);
|
||||
|
||||
/// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
|
||||
diff --git a/src/backend/libc/net/sockopt.rs b/src/backend/libc/net/sockopt.rs
|
||||
index 132ebe75..a9e32d37 100644
|
||||
--- a/src/backend/libc/net/sockopt.rs
|
||||
+++ b/src/backend/libc/net/sockopt.rs
|
||||
@@ -76,7 +76,7 @@ use c::TCP_KEEPALIVE as TCP_KEEPIDLE;
|
||||
use c::TCP_KEEPIDLE;
|
||||
use core::mem::{size_of, MaybeUninit};
|
||||
use core::time::Duration;
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
use linux_raw_sys::xdp::{xdp_mmap_offsets, xdp_statistics, xdp_statistics_v1};
|
||||
#[cfg(windows)]
|
||||
use windows_sys::Win32::Foundation::BOOL;
|
||||
@@ -1090,7 +1090,7 @@ pub(crate) fn set_xdp_rx_ring_size(fd: BorrowedFd<'_>, value: u32) -> io::Result
|
||||
setsockopt(fd, c::SOL_XDP, c::XDP_RX_RING, value)
|
||||
}
|
||||
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[inline]
|
||||
pub(crate) fn xdp_mmap_offsets(fd: BorrowedFd<'_>) -> io::Result<XdpMmapOffsets> {
|
||||
// The kernel will write `xdp_mmap_offsets` or `xdp_mmap_offsets_v1` to the
|
||||
@@ -1177,7 +1177,7 @@ pub(crate) fn xdp_mmap_offsets(fd: BorrowedFd<'_>) -> io::Result<XdpMmapOffsets>
|
||||
}
|
||||
}
|
||||
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[inline]
|
||||
pub(crate) fn xdp_statistics(fd: BorrowedFd<'_>) -> io::Result<XdpStatistics> {
|
||||
let mut optlen = size_of::<xdp_statistics>().try_into().unwrap();
|
||||
diff --git a/src/fs/constants.rs b/src/fs/constants.rs
|
||||
index 5f106342..337b67e6 100644
|
||||
--- a/src/fs/constants.rs
|
||||
+++ b/src/fs/constants.rs
|
||||
@@ -56,12 +56,12 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_layouts() {
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
assert_eq_size!(FsWord, linux_raw_sys::general::__fsword_t);
|
||||
|
||||
// Don't test against `__kernel_mode_t` on platforms where it's a
|
||||
// `u16`.
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
#[cfg(not(any(
|
||||
target_arch = "x86",
|
||||
target_arch = "sparc",
|
||||
@@ -70,7 +70,7 @@ mod tests {
|
||||
)))]
|
||||
assert_eq_size!(RawMode, linux_raw_sys::general::__kernel_mode_t);
|
||||
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
#[cfg(any(
|
||||
target_arch = "x86",
|
||||
target_arch = "sparc",
|
||||
diff --git a/src/fs/ioctl.rs b/src/fs/ioctl.rs
|
||||
index c126fdd1..16e0dda1 100644
|
||||
--- a/src/fs/ioctl.rs
|
||||
+++ b/src/fs/ioctl.rs
|
||||
@@ -58,7 +58,7 @@ pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result
|
||||
}
|
||||
|
||||
/// `ioctl(fd, EXT4_IOC_RESIZE_FS, blocks)`—Resize ext4 filesystem on fd.
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[inline]
|
||||
#[doc(alias = "EXT4_IOC_RESIZE_FS")]
|
||||
pub fn ext4_ioc_resize_fs<Fd: AsFd>(fd: Fd, blocks: u64) -> io::Result<()> {
|
||||
@@ -94,7 +94,7 @@ unsafe impl ioctl::Ioctl for Ficlone<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
bitflags! {
|
||||
/// `FS_*` constants for use with [`ioctl_getflags`].
|
||||
///
|
||||
@@ -136,7 +136,7 @@ bitflags! {
|
||||
/// `ioctl(fd, FS_IOC_GETFLAGS)`—Returns the [inode flags] attributes
|
||||
///
|
||||
/// [inode flags]: https://man7.org/linux/man-pages/man2/ioctl_iflags.2.html
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[inline]
|
||||
#[doc(alias = "FS_IOC_GETFLAGS")]
|
||||
pub fn ioctl_getflags<Fd: AsFd>(fd: Fd) -> io::Result<IFlags> {
|
||||
@@ -153,7 +153,7 @@ pub fn ioctl_getflags<Fd: AsFd>(fd: Fd) -> io::Result<IFlags> {
|
||||
/// `ioctl(fd, FS_IOC_SETFLAGS)`—Modify the [inode flags] attributes
|
||||
///
|
||||
/// [inode flags]: https://man7.org/linux/man-pages/man2/ioctl_iflags.2.html
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[inline]
|
||||
#[doc(alias = "FS_IOC_SETFLAGS")]
|
||||
pub fn ioctl_setflags<Fd: AsFd>(fd: Fd, flags: IFlags) -> io::Result<()> {
|
||||
diff --git a/src/fs/mod.rs b/src/fs/mod.rs
|
||||
index 505925f7..1807ada6 100644
|
||||
--- a/src/fs/mod.rs
|
||||
+++ b/src/fs/mod.rs
|
||||
@@ -30,7 +30,7 @@ pub(crate) mod fd;
|
||||
mod getpath;
|
||||
#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
|
||||
mod id;
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
pub mod inotify;
|
||||
#[cfg(linux_kernel)]
|
||||
mod ioctl;
|
||||
@@ -45,7 +45,7 @@ mod ioctl;
|
||||
mod makedev;
|
||||
#[cfg(any(linux_kernel, target_os = "freebsd"))]
|
||||
mod memfd_create;
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
mod openat2;
|
||||
#[cfg(linux_kernel)]
|
||||
mod raw_dir;
|
||||
@@ -110,7 +110,7 @@ pub use ioctl::*;
|
||||
pub use makedev::*;
|
||||
#[cfg(any(linux_kernel, target_os = "freebsd"))]
|
||||
pub use memfd_create::memfd_create;
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
pub use openat2::openat2;
|
||||
#[cfg(linux_kernel)]
|
||||
pub use raw_dir::{RawDir, RawDirEntry};
|
||||
diff --git a/src/fs/raw_dir.rs b/src/fs/raw_dir.rs
|
||||
index 7fec6fd7..9691ca71 100644
|
||||
--- a/src/fs/raw_dir.rs
|
||||
+++ b/src/fs/raw_dir.rs
|
||||
@@ -7,6 +7,10 @@ use crate::fs::FileType;
|
||||
use crate::io;
|
||||
use core::fmt;
|
||||
use core::mem::{align_of, MaybeUninit};
|
||||
+
|
||||
+#[cfg(not(linux_raw_dep))]
|
||||
+use libc::dirent64 as linux_dirent64;
|
||||
+#[cfg(linux_raw_dep)]
|
||||
use linux_raw_sys::general::linux_dirent64;
|
||||
|
||||
/// A directory iterator implemented with getdents.
|
||||
diff --git a/src/io/read_write.rs b/src/io/read_write.rs
|
||||
index 572c7b65..0e096910 100644
|
||||
--- a/src/io/read_write.rs
|
||||
+++ b/src/io/read_write.rs
|
||||
@@ -10,7 +10,7 @@ use backend::fd::AsFd;
|
||||
#[cfg(not(windows))]
|
||||
pub use crate::maybe_polyfill::io::{IoSlice, IoSliceMut};
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
pub use backend::io::types::ReadWriteFlags;
|
||||
|
||||
/// `read(fd, buf)`—Reads from a stream.
|
||||
@@ -277,7 +277,7 @@ pub fn pwritev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Resul
|
||||
///
|
||||
/// [Linux]: https://man7.org/linux/man-pages/man2/preadv2.2.html
|
||||
/// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Scatter_002dGather.html#index-preadv64v2
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
#[inline]
|
||||
pub fn preadv2<Fd: AsFd>(
|
||||
fd: Fd,
|
||||
@@ -298,7 +298,7 @@ pub fn preadv2<Fd: AsFd>(
|
||||
///
|
||||
/// [Linux]: https://man7.org/linux/man-pages/man2/pwritev2.2.html
|
||||
/// [glibc]: https://sourceware.org/glibc/manual/latest/html_node/Scatter_002dGather.html#index-pwritev64v2
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(all(linux_kernel, not(target_os = "android")))]
|
||||
#[inline]
|
||||
pub fn pwritev2<Fd: AsFd>(
|
||||
fd: Fd,
|
||||
diff --git a/src/ioctl/linux.rs b/src/ioctl/linux.rs
|
||||
index 7215228a..8d96a1b2 100644
|
||||
--- a/src/ioctl/linux.rs
|
||||
+++ b/src/ioctl/linux.rs
|
||||
@@ -88,12 +88,12 @@ mod tests {
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
- #[cfg(not(any(
|
||||
+ #[cfg(all(linux_raw_dep, not(any(
|
||||
// These have no ioctl opcodes defined in linux_raw_sys so we can't use
|
||||
// that as a known-good value for this test.
|
||||
target_arch = "sparc",
|
||||
target_arch = "sparc64"
|
||||
-)))]
|
||||
+))))]
|
||||
#[test]
|
||||
fn check_known_opcodes() {
|
||||
use crate::backend::c::{c_long, c_uint};
|
||||
diff --git a/src/ioctl/mod.rs b/src/ioctl/mod.rs
|
||||
index e3e8f8e1..4beed113 100644
|
||||
--- a/src/ioctl/mod.rs
|
||||
+++ b/src/ioctl/mod.rs
|
||||
@@ -344,7 +344,7 @@ type _Opcode = c::c_uint;
|
||||
#[cfg(windows)]
|
||||
type _Opcode = i32;
|
||||
|
||||
-#[cfg(linux_kernel)]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs
|
||||
index ef8176ae..145f32be 100644
|
||||
--- a/src/net/sockopt.rs
|
||||
+++ b/src/net/sockopt.rs
|
||||
@@ -1604,7 +1604,7 @@ pub fn set_xdp_rx_ring_size<Fd: AsFd>(fd: Fd, value: u32) -> io::Result<()> {
|
||||
/// - [Linux]
|
||||
///
|
||||
/// [Linux]: https://www.kernel.org/doc/html/next/networking/af_xdp.html
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[doc(alias = "XDP_MMAP_OFFSETS")]
|
||||
pub fn xdp_mmap_offsets<Fd: AsFd>(fd: Fd) -> io::Result<XdpMmapOffsets> {
|
||||
backend::net::sockopt::xdp_mmap_offsets(fd.as_fd())
|
||||
@@ -1616,7 +1616,7 @@ pub fn xdp_mmap_offsets<Fd: AsFd>(fd: Fd) -> io::Result<XdpMmapOffsets> {
|
||||
/// - [Linux]
|
||||
///
|
||||
/// [Linux]: https://www.kernel.org/doc/html/next/networking/af_xdp.html#xdp-statistics-getsockopt
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(linux_raw_dep)]
|
||||
#[doc(alias = "XDP_STATISTICS")]
|
||||
pub fn xdp_statistics<Fd: AsFd>(fd: Fd) -> io::Result<XdpStatistics> {
|
||||
backend::net::sockopt::xdp_statistics(fd.as_fd())
|
||||
diff --git a/src/net/types.rs b/src/net/types.rs
|
||||
index 057f944d..43dfa610 100644
|
||||
--- a/src/net/types.rs
|
||||
+++ b/src/net/types.rs
|
||||
@@ -1321,10 +1321,10 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const PUPAT: Protocol = Protocol(new_raw_protocol((c::ETH_P_PUPAT as u16).to_be() as u32));
|
||||
/// `ETH_P_TSN`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const TSN: Protocol = Protocol(new_raw_protocol((c::ETH_P_TSN as u16).to_be() as u32));
|
||||
/// `ETH_P_ERSPAN2`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const ERSPAN2: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_ERSPAN2 as u16).to_be() as u32));
|
||||
/// `ETH_P_IP`
|
||||
@@ -1395,7 +1395,7 @@ pub mod eth {
|
||||
pub const P_8021Q: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_8021Q as u16).to_be() as u32));
|
||||
/// `ETH_P_ERSPAN`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const ERSPAN: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_ERSPAN as u16).to_be() as u32));
|
||||
/// `ETH_P_IPX`
|
||||
@@ -1445,18 +1445,18 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const PAE: Protocol = Protocol(new_raw_protocol((c::ETH_P_PAE as u16).to_be() as u32));
|
||||
/// `ETH_P_PROFINET`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const PROFINET: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_PROFINET as u16).to_be() as u32));
|
||||
/// `ETH_P_REALTEK`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const REALTEK: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_REALTEK as u16).to_be() as u32));
|
||||
/// `ETH_P_AOE`
|
||||
#[cfg(linux_kernel)]
|
||||
pub const AOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_AOE as u16).to_be() as u32));
|
||||
/// `ETH_P_ETHERCAT`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const ETHERCAT: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_ETHERCAT as u16).to_be() as u32));
|
||||
/// `ETH_P_8021AD`
|
||||
@@ -1468,17 +1468,17 @@ pub mod eth {
|
||||
pub const P_802_EX1: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_802_EX1 as u16).to_be() as u32));
|
||||
/// `ETH_P_PREAUTH`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const PREAUTH: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_PREAUTH as u16).to_be() as u32));
|
||||
/// `ETH_P_TIPC`
|
||||
#[cfg(linux_kernel)]
|
||||
pub const TIPC: Protocol = Protocol(new_raw_protocol((c::ETH_P_TIPC as u16).to_be() as u32));
|
||||
/// `ETH_P_LLDP`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const LLDP: Protocol = Protocol(new_raw_protocol((c::ETH_P_LLDP as u16).to_be() as u32));
|
||||
/// `ETH_P_MRP`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const MRP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MRP as u16).to_be() as u32));
|
||||
/// `ETH_P_MACSEC`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1495,19 +1495,19 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const P_1588: Protocol = Protocol(new_raw_protocol((c::ETH_P_1588 as u16).to_be() as u32));
|
||||
/// `ETH_P_NCSI`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const NCSI: Protocol = Protocol(new_raw_protocol((c::ETH_P_NCSI as u16).to_be() as u32));
|
||||
/// `ETH_P_PRP`
|
||||
#[cfg(linux_kernel)]
|
||||
pub const PRP: Protocol = Protocol(new_raw_protocol((c::ETH_P_PRP as u16).to_be() as u32));
|
||||
/// `ETH_P_CFM`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const CFM: Protocol = Protocol(new_raw_protocol((c::ETH_P_CFM as u16).to_be() as u32));
|
||||
/// `ETH_P_FCOE`
|
||||
#[cfg(linux_kernel)]
|
||||
pub const FCOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_FCOE as u16).to_be() as u32));
|
||||
/// `ETH_P_IBOE`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const IBOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_IBOE as u16).to_be() as u32));
|
||||
/// `ETH_P_TDLS`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1520,10 +1520,10 @@ pub mod eth {
|
||||
pub const P_80221: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_80221 as u16).to_be() as u32));
|
||||
/// `ETH_P_HSR`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const HSR: Protocol = Protocol(new_raw_protocol((c::ETH_P_HSR as u16).to_be() as u32));
|
||||
/// `ETH_P_NSH`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const NSH: Protocol = Protocol(new_raw_protocol((c::ETH_P_NSH as u16).to_be() as u32));
|
||||
/// `ETH_P_LOOPBACK`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1542,15 +1542,15 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const EDSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_EDSA as u16).to_be() as u32));
|
||||
/// `ETH_P_DSA_8021Q`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const DSA_8021Q: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_DSA_8021Q as u16).to_be() as u32));
|
||||
/// `ETH_P_DSA_A5PSW`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const DSA_A5PSW: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_DSA_A5PSW as u16).to_be() as u32));
|
||||
/// `ETH_P_IFE`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const IFE: Protocol = Protocol(new_raw_protocol((c::ETH_P_IFE as u16).to_be() as u32));
|
||||
/// `ETH_P_AF_IUCV`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1568,7 +1568,7 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const AX25: Protocol = Protocol(new_raw_protocol((c::ETH_P_AX25 as u16).to_be() as u32));
|
||||
/// `ETH_P_ALL`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const ALL: Protocol = Protocol(new_raw_protocol((c::ETH_P_ALL as u16).to_be() as u32));
|
||||
/// `ETH_P_802_2`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1593,13 +1593,13 @@ pub mod eth {
|
||||
pub const LOCALTALK: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_LOCALTALK as u16).to_be() as u32));
|
||||
/// `ETH_P_CAN`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const CAN: Protocol = Protocol(new_raw_protocol((c::ETH_P_CAN as u16).to_be() as u32));
|
||||
/// `ETH_P_CANFD`
|
||||
#[cfg(linux_kernel)]
|
||||
pub const CANFD: Protocol = Protocol(new_raw_protocol((c::ETH_P_CANFD as u16).to_be() as u32));
|
||||
/// `ETH_P_CANXL`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const CANXL: Protocol = Protocol(new_raw_protocol((c::ETH_P_CANXL as u16).to_be() as u32));
|
||||
/// `ETH_P_PPPTALK`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1632,7 +1632,7 @@ pub mod eth {
|
||||
pub const ARCNET: Protocol =
|
||||
Protocol(new_raw_protocol((c::ETH_P_ARCNET as u16).to_be() as u32));
|
||||
/// `ETH_P_DSA`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const DSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_DSA as u16).to_be() as u32));
|
||||
/// `ETH_P_TRAILER`
|
||||
#[cfg(linux_kernel)]
|
||||
@@ -1650,13 +1650,13 @@ pub mod eth {
|
||||
#[cfg(linux_kernel)]
|
||||
pub const CAIF: Protocol = Protocol(new_raw_protocol((c::ETH_P_CAIF as u16).to_be() as u32));
|
||||
/// `ETH_P_XDSA`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const XDSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_XDSA as u16).to_be() as u32));
|
||||
/// `ETH_P_MAP`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const MAP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MAP as u16).to_be() as u32));
|
||||
/// `ETH_P_MCTP`
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
pub const MCTP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MCTP as u16).to_be() as u32));
|
||||
}
|
||||
|
||||
diff --git a/src/timespec.rs b/src/timespec.rs
|
||||
index f5404ba4..a6458bbc 100644
|
||||
--- a/src/timespec.rs
|
||||
+++ b/src/timespec.rs
|
||||
@@ -411,7 +411,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that `Timespec` matches Linux's `__kernel_timespec`.
|
||||
- #[cfg(linux_kernel)]
|
||||
+ #[cfg(linux_raw_dep)]
|
||||
#[test]
|
||||
fn test_against_kernel_timespec() {
|
||||
assert_eq_size!(Timespec, linux_raw_sys::general::__kernel_timespec);
|
||||
--
|
||||
2.50.0.727.gbf7dc18ff4-goog
|
||||
|
||||
|
|
@ -10,14 +10,15 @@ project(
|
|||
|
||||
errno = subproject('errno').get_variable('lib')
|
||||
libc = subproject('libc').get_variable('lib')
|
||||
linux_raw_sys = subproject('linux-raw-sys').get_variable('lib')
|
||||
bitflags = subproject('bitflags').get_variable('lib')
|
||||
|
||||
rustix_args = []
|
||||
if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
||||
rustix_args += [
|
||||
'--cfg', 'linux_raw',
|
||||
'--cfg', 'linux_like',
|
||||
'--cfg', 'linux_kernel',
|
||||
'--cfg', 'libc',
|
||||
'--cfg', 'feature="use-libc"',
|
||||
'--cfg', 'feature="std"',
|
||||
'--cfg', 'feature="alloc"',
|
||||
'--cfg', 'feature="event"',
|
||||
|
|
@ -33,12 +34,12 @@ lib = static_library(
|
|||
'rustix',
|
||||
'src/lib.rs',
|
||||
override_options : ['rust_std=2021', 'build.rust_std=2021'],
|
||||
link_with : [errno, libc, linux_raw_sys, bitflags],
|
||||
link_with : [errno, libc, bitflags],
|
||||
rust_abi : 'rust',
|
||||
native : true,
|
||||
rust_args: rustix_args,
|
||||
)
|
||||
|
||||
dep_rustix = declare_dependency(
|
||||
link_with : [lib, errno, libc, linux_raw_sys, bitflags]
|
||||
link_with : [lib, errno, libc, bitflags]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,3 +4,5 @@ source_url = https://crates.io/api/v1/crates/rustix/1.0.7/download
|
|||
source_filename = rustix-1.0.7.tar.gz
|
||||
source_hash = c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266
|
||||
patch_directory = rustix
|
||||
|
||||
diff_files = rustix/0001-BACKPORT-rustix-on-Linux-support-a-build-without-lin.patch
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue