Skip to content

Commit 37ef021

Browse files
authored
Miscellaneous cleanups (#842)
- Update to libc 0.2.148, which has `SO_DOMAIN` for OpenBSD and Solarish. - Enable `Mode` constants on WASI, which now defines them. - Simplify some `cfg`s and `allow`s.
1 parent 26ece58 commit 37ef021

File tree

30 files changed

+79
-110
lines changed

30 files changed

+79
-110
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ once_cell = { version = "1.5.2", optional = true }
3838
[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies]
3939
linux-raw-sys = { version = "0.4.7", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] }
4040
libc_errno = { package = "errno", version = "0.3.1", default-features = false, optional = true }
41-
libc = { version = "0.2.147", default-features = false, features = ["extra_traits"], optional = true }
41+
libc = { version = "0.2.148", default-features = false, features = ["extra_traits"], optional = true }
4242

4343
# Dependencies for platforms where only libc is supported:
4444
#
4545
# On all other Unix-family platforms, and under Miri, we always use the libc
4646
# backend, so enable its dependencies unconditionally.
4747
[target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
4848
libc_errno = { package = "errno", version = "0.3.1", default-features = false }
49-
libc = { version = "0.2.147", default-features = false, features = ["extra_traits"] }
49+
libc = { version = "0.2.148", default-features = false, features = ["extra_traits"] }
5050

5151
# Additional dependencies for Linux with the libc backend:
5252
#
@@ -74,7 +74,7 @@ default-features = false
7474

7575
[dev-dependencies]
7676
tempfile = "3.5.0"
77-
libc = "0.2.147"
77+
libc = "0.2.148"
7878
libc_errno = { package = "errno", version = "0.3.1", default-features = false }
7979
serial_test = "2.0.0"
8080
memoffset = "0.9.0"

benches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ mod suite {
125125
b.iter(|| {
126126
let mut s = std::mem::MaybeUninit::<libc::stat>::uninit();
127127
unsafe {
128-
assert_eq!(libc::fstat(libc::STDIN_FILENO, s.as_mut_ptr(),), 0);
128+
assert_eq!(libc::fstat(libc::STDIN_FILENO, s.as_mut_ptr()), 0);
129129
}
130130
})
131131
});

src/backend/libc/fs/types.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,63 +92,63 @@ bitflags! {
9292
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
9393
pub struct Mode: RawMode {
9494
/// `S_IRWXU`
95-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
95+
#[cfg(not(target_os = "espidf"))]
9696
const RWXU = c::S_IRWXU as RawMode;
9797

9898
/// `S_IRUSR`
99-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
99+
#[cfg(not(target_os = "espidf"))]
100100
const RUSR = c::S_IRUSR as RawMode;
101101

102102
/// `S_IWUSR`
103-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
103+
#[cfg(not(target_os = "espidf"))]
104104
const WUSR = c::S_IWUSR as RawMode;
105105

106106
/// `S_IXUSR`
107-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
107+
#[cfg(not(target_os = "espidf"))]
108108
const XUSR = c::S_IXUSR as RawMode;
109109

110110
/// `S_IRWXG`
111-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
111+
#[cfg(not(target_os = "espidf"))]
112112
const RWXG = c::S_IRWXG as RawMode;
113113

114114
/// `S_IRGRP`
115-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
115+
#[cfg(not(target_os = "espidf"))]
116116
const RGRP = c::S_IRGRP as RawMode;
117117

118118
/// `S_IWGRP`
119-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
119+
#[cfg(not(target_os = "espidf"))]
120120
const WGRP = c::S_IWGRP as RawMode;
121121

122122
/// `S_IXGRP`
123-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
123+
#[cfg(not(target_os = "espidf"))]
124124
const XGRP = c::S_IXGRP as RawMode;
125125

126126
/// `S_IRWXO`
127-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
127+
#[cfg(not(target_os = "espidf"))]
128128
const RWXO = c::S_IRWXO as RawMode;
129129

130130
/// `S_IROTH`
131-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
131+
#[cfg(not(target_os = "espidf"))]
132132
const ROTH = c::S_IROTH as RawMode;
133133

134134
/// `S_IWOTH`
135-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
135+
#[cfg(not(target_os = "espidf"))]
136136
const WOTH = c::S_IWOTH as RawMode;
137137

138138
/// `S_IXOTH`
139-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
139+
#[cfg(not(target_os = "espidf"))]
140140
const XOTH = c::S_IXOTH as RawMode;
141141

142142
/// `S_ISUID`
143-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
143+
#[cfg(not(target_os = "espidf"))]
144144
const SUID = c::S_ISUID as RawMode;
145145

146146
/// `S_ISGID`
147-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
147+
#[cfg(not(target_os = "espidf"))]
148148
const SGID = c::S_ISGID as RawMode;
149149

150150
/// `S_ISVTX`
151-
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
151+
#[cfg(not(target_os = "espidf"))]
152152
const SVTX = c::S_ISVTX as RawMode;
153153

154154
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>

src/backend/libc/net/syscalls.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,6 @@ pub(crate) mod sockopt {
523523
use crate::net::sockopt::Timeout;
524524
#[cfg(not(any(
525525
apple,
526-
solarish,
527526
windows,
528527
target_os = "aix",
529528
target_os = "dragonfly",
@@ -532,7 +531,6 @@ pub(crate) mod sockopt {
532531
target_os = "haiku",
533532
target_os = "netbsd",
534533
target_os = "nto",
535-
target_os = "openbsd"
536534
)))]
537535
use crate::net::AddressFamily;
538536
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
@@ -835,7 +833,6 @@ pub(crate) mod sockopt {
835833
#[inline]
836834
#[cfg(not(any(
837835
apple,
838-
solarish,
839836
windows,
840837
target_os = "aix",
841838
target_os = "dragonfly",
@@ -844,7 +841,6 @@ pub(crate) mod sockopt {
844841
target_os = "haiku",
845842
target_os = "netbsd",
846843
target_os = "nto",
847-
target_os = "openbsd"
848844
)))]
849845
pub(crate) fn get_socket_domain(fd: BorrowedFd<'_>) -> io::Result<AddressFamily> {
850846
let domain: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_DOMAIN)?;

src/backend/linux_raw/arch/x86.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ pub(in crate::backend) unsafe fn indirect_syscall5(
163163
FromAsm::from_asm(r0)
164164
}
165165

166-
#[allow(clippy::too_many_arguments)]
167166
#[inline]
168167
pub(in crate::backend) unsafe fn indirect_syscall6(
169168
callee: SyscallType,

src/backend/linux_raw/c.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub(crate) use linux_raw_sys::general::{
4040
XATTR_REPLACE,
4141
};
4242

43-
#[allow(unused)]
4443
pub(crate) use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE};
4544

4645
#[cfg(feature = "io_uring")]

src/backend/linux_raw/event/syscalls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
//! # Safety
44
//!
55
//! See the `rustix::backend` module documentation for details.
6-
#![allow(unsafe_code)]
7-
#![allow(clippy::undocumented_unsafe_blocks)]
6+
#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
87

98
use crate::backend::c;
109
use crate::backend::conv::{c_int, c_uint, ret_owned_fd, ret_usize, slice_mut};

src/backend/linux_raw/io_uring/syscalls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
//! # Safety
44
//!
55
//! See the `rustix::backend::syscalls` module documentation for details.
6-
#![allow(unsafe_code)]
7-
#![allow(clippy::undocumented_unsafe_blocks)]
6+
#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
87

98
use crate::backend::conv::{by_mut, c_uint, pass_usize, ret_c_uint, ret_owned_fd};
109
use crate::fd::{BorrowedFd, OwnedFd};

src/backend/linux_raw/net/syscalls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
//! # Safety
44
//!
55
//! See the `rustix::backend` module documentation for details.
6-
#![allow(unsafe_code)]
7-
#![allow(clippy::undocumented_unsafe_blocks)]
6+
#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
87

98
use super::msghdr::{
109
with_noaddr_msghdr, with_recv_msghdr, with_unix_msghdr, with_v4_msghdr, with_v6_msghdr,

src/backend/linux_raw/pid/syscalls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
//! # Safety
44
//!
55
//! See the `rustix::backend` module documentation for details.
6-
#![allow(unsafe_code)]
7-
#![allow(clippy::undocumented_unsafe_blocks)]
6+
#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
87

98
use crate::backend::conv::ret_usize_infallible;
109
use crate::pid::{Pid, RawPid};

0 commit comments

Comments
 (0)