Skip to content

Commit 730b0d2

Browse files
authored
Add a linux_kernel cfg, to simplify a common platform set. (#675)
"android" and "linux" share much in common, so add a `linux_kernel` config to factor out `any(target_os = "android", target_os = "linux")`.
1 parent 1c1fc80 commit 730b0d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+380
-567
lines changed

build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ fn main() {
140140
{
141141
use_feature("bsd");
142142
}
143+
144+
// Add some additional common target combinations.
145+
if target_os == "android" || target_os == "linux" {
146+
use_feature("linux_kernel");
147+
}
148+
143149
if target_os == "wasi" {
144150
use_feature_or_nothing("wasi_ext");
145151
}

src/backend/libc/c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
pub(crate) use libc::*;
22

33
/// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem.
4-
#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
4+
#[cfg(all(linux_kernel, target_env = "musl"))]
55
pub(crate) const PROC_SUPER_MAGIC: u32 = 0x0000_9fa0;
66

77
/// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem.
8-
#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
8+
#[cfg(all(linux_kernel, target_env = "musl"))]
99
pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969;

src/backend/libc/conv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub(super) fn syscall_ret_usize(raw: c::c_long) -> io::Result<usize> {
107107
}
108108
}
109109

110-
#[cfg(any(target_os = "android", target_os = "linux"))]
110+
#[cfg(linux_kernel)]
111111
#[inline]
112112
pub(super) fn syscall_ret_u32(raw: c::c_long) -> io::Result<u32> {
113113
if raw == -1 {

src/backend/libc/fs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[cfg(not(target_os = "redox"))]
22
pub(crate) mod dir;
3-
#[cfg(any(target_os = "android", target_os = "linux"))]
3+
#[cfg(linux_kernel)]
44
pub mod inotify;
55
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
66
pub(crate) mod makedev;

0 commit comments

Comments
 (0)