Skip to content

Commit 9e15134

Browse files
committed
Make the "param" module depend on the "fs" module.
In some configurations, the param module needs to open /proc/self/auxv, and it needs the fs API to do that, so make the param module depend on the fs module. Also, disable the init_from_proc_self_auxv code on mustang, which doesn't need it.
1 parent aa08658 commit 9e15134

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ process = []
144144
time = []
145145

146146
# Enable `rustix::param::*`.
147-
param = []
147+
param = ["fs"]
148148

149149
# Enable this to enable `rustix::io::proc_self_*` (on Linux) and `ttyname`.
150150
procfs = ["once_cell", "itoa", "fs"]

src/backend/linux_raw/param/auxv.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use super::super::elf::*;
1010
use crate::fd::OwnedFd;
1111
#[cfg(feature = "param")]
1212
use crate::ffi::CStr;
13+
#[cfg(not(target_vendor = "mustang"))]
1314
use crate::fs::{Mode, OFlags};
1415
use crate::utils::{as_ptr, check_raw_pointer};
1516
use alloc::vec::Vec;
@@ -130,6 +131,7 @@ static PHNUM: AtomicUsize = AtomicUsize::new(0);
130131
static EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(null_mut());
131132

132133
/// On non-Mustang platforms, we read the aux vector from /proc/self/auxv.
134+
#[cfg(not(target_vendor = "mustang"))]
133135
fn init_from_proc_self_auxv() {
134136
// Open "/proc/self/auxv", either because we trust "/proc", or because
135137
// we're running inside QEMU and `proc_self_auxv`'s extra checking foils
@@ -146,6 +148,11 @@ fn init_from_proc_self_auxv() {
146148
let _ = init_from_auxv_file(file);
147149
}
148150

151+
#[cfg(target_vendor = "mustang")]
152+
fn init_from_proc_self_auxv() {
153+
panic!("mustang should have initialized the auxv values");
154+
}
155+
149156
/// Process auxv entries from the open file `auxv`.
150157
fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
151158
let mut buffer = Vec::<u8>::with_capacity(512);

0 commit comments

Comments
 (0)