Skip to content

Commit 83dfd90

Browse files
authored
refactor: apply the netbsdlike alias for src/* (#2231)
* refactor: apply the netbsdlike alias for src/* * remove openbsd
1 parent 0bb23ca commit 83dfd90

File tree

17 files changed

+66
-216
lines changed

17 files changed

+66
-216
lines changed

src/errno.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ cfg_if! {
1212
unsafe fn errno_location() -> *mut c_int {
1313
unsafe { libc::__error() }
1414
}
15-
} else if #[cfg(any(target_os = "android",
16-
target_os = "netbsd",
17-
target_os = "openbsd"))] {
15+
} else if #[cfg(any(target_os = "android", netbsdlike))] {
1816
unsafe fn errno_location() -> *mut c_int {
1917
unsafe { libc::__errno() }
2018
}

src/fcntl.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ libc_bitflags!(
9999
#[cfg(not(solarish))]
100100
O_DIRECTORY;
101101
/// Implicitly follow each `write()` with an `fdatasync()`.
102-
#[cfg(any(linux_android,
103-
apple_targets,
104-
target_os = "netbsd",
105-
target_os = "openbsd"))]
102+
#[cfg(any(linux_android, apple_targets, netbsdlike))]
106103
O_DSYNC;
107104
/// Error out if a file was not created.
108105
O_EXCL;
@@ -150,7 +147,7 @@ libc_bitflags!(
150147
/// This should not be combined with `O_WRONLY` or `O_RDONLY`.
151148
O_RDWR;
152149
/// Similar to `O_DSYNC` but applies to `read`s instead.
153-
#[cfg(any(target_os = "linux", target_os = "netbsd", target_os = "openbsd"))]
150+
#[cfg(any(target_os = "linux", netbsdlike))]
154151
O_RSYNC;
155152
/// Skip search permission checks.
156153
#[cfg(target_os = "netbsd")]

src/features.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ mod os {
9999

100100
#[cfg(any(
101101
freebsdlike, // FreeBSD since 10.0 DragonFlyBSD since ???
102+
netbsdlike, // NetBSD since 6.0 OpenBSD since 5.7
102103
target_os = "illumos", // Since ???
103-
target_os = "netbsd", // Since 6.0
104-
target_os = "openbsd", // Since 5.7
105104
target_os = "redox", // Since 1-july-2020
106105
))]
107106
mod os {

src/mount/bsd.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ libc_bitflags!(
6161
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
6262
MNT_SNAPSHOT;
6363
/// Using soft updates.
64-
#[cfg(any(
65-
freebsdlike,
66-
target_os = "netbsd",
67-
target_os = "openbsd"
68-
))]
64+
#[cfg(any(freebsdlike, netbsdlike))]
6965
MNT_SOFTDEP;
7066
/// Directories with the SUID bit set chown new files to their own
7167
/// owner.

src/mount/mod.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ mod linux;
55
#[cfg(linux_android)]
66
pub use self::linux::*;
77

8-
#[cfg(any(
9-
freebsdlike,
10-
target_os = "macos",
11-
target_os = "netbsd",
12-
target_os = "openbsd"
13-
))]
8+
#[cfg(any(freebsdlike, netbsdlike, target_os = "macos"))]
149
mod bsd;
1510

16-
#[cfg(any(
17-
freebsdlike,
18-
target_os = "macos",
19-
target_os = "netbsd",
20-
target_os = "openbsd"
21-
))]
11+
#[cfg(any(freebsdlike, netbsdlike, target_os = "macos"))]
2212
pub use self::bsd::*;

src/net/if_.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ libc_bitflags!(
7272
#[cfg(any(linux_android, target_os = "fuchsia"))]
7373
IFF_MASTER;
7474
/// transmission in progress, tx hardware queue is full
75-
#[cfg(any(target_os = "freebsd",
76-
apple_targets,
77-
target_os = "netbsd",
78-
target_os = "openbsd"))]
75+
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
7976
IFF_OACTIVE;
8077
/// Protocol code on board.
8178
#[cfg(solarish)]
@@ -85,10 +82,7 @@ libc_bitflags!(
8582
#[cfg(any(linux_android, target_os = "fuchsia"))]
8683
IFF_SLAVE;
8784
/// Can't hear own transmissions.
88-
#[cfg(any(freebsdlike,
89-
target_os = "macos",
90-
target_os = "netbsd",
91-
target_os = "openbsd"))]
85+
#[cfg(any(freebsdlike, netbsdlike, target_os = "macos"))]
9286
IFF_SIMPLEX;
9387
/// Supports multicast. (see
9488
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))

src/sys/aio.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ libc_enum! {
5555
/// on supported operating systems only, do it like `fdatasync`
5656
#[cfg(any(apple_targets,
5757
target_os = "linux",
58-
target_os = "netbsd",
59-
target_os = "openbsd"))]
58+
netbsdlike))]
6059
O_DSYNC
6160
}
6261
impl TryFrom<i32>

src/sys/mman.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ libc_bitflags! {
134134
/// Rename private pages to a file.
135135
///
136136
/// This was removed in FreeBSD 11 and is unused in DragonFlyBSD.
137-
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
137+
#[cfg(netbsdlike)]
138138
MAP_RENAME;
139139
/// Region may contain semaphores.
140-
#[cfg(any(freebsdlike, target_os = "netbsd", target_os = "openbsd"))]
140+
#[cfg(any(freebsdlike, netbsdlike))]
141141
MAP_HASSEMAPHORE;
142142
/// Region grows down, like a stack.
143143
#[cfg(any(linux_android, freebsdlike, target_os = "openbsd"))]

src/sys/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ feature! {
6666
pub mod pthread;
6767
}
6868

69-
#[cfg(any(
70-
linux_android,
71-
freebsdlike,
72-
target_os = "macos",
73-
target_os = "netbsd",
74-
target_os = "openbsd"
75-
))]
69+
#[cfg(any(linux_android, freebsdlike, target_os = "macos", netbsdlike))]
7670
feature! {
7771
#![feature = "ptrace"]
7872
#[allow(missing_docs)]

src/sys/ptrace/mod.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,8 @@ mod linux;
66
#[cfg(linux_android)]
77
pub use self::linux::*;
88

9-
#[cfg(any(
10-
freebsdlike,
11-
target_os = "macos",
12-
target_os = "netbsd",
13-
target_os = "openbsd"
14-
))]
9+
#[cfg(any(freebsdlike, netbsdlike, target_os = "macos"))]
1510
mod bsd;
1611

17-
#[cfg(any(
18-
freebsdlike,
19-
target_os = "macos",
20-
target_os = "netbsd",
21-
target_os = "openbsd"
22-
))]
12+
#[cfg(any(freebsdlike, netbsdlike, target_os = "macos"))]
2313
pub use self::bsd::*;

0 commit comments

Comments
 (0)