Skip to content

Commit 6d2b8a0

Browse files
authored
Merge pull request #3852 from tgross35/backport-onion
[0.2] Backport two FreeBSD-related pull requests
2 parents 64ee9df + 9e43d14 commit 6d2b8a0

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

build.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ fn main() {
6565
//
6666
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
6767
// running tests to ensure that the ABI is correct.
68-
match which_freebsd() {
69-
Some(10) if libc_ci => set_cfg("freebsd10"),
70-
Some(11) if libc_ci => set_cfg("freebsd11"),
71-
Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"),
72-
Some(13) if libc_ci => set_cfg("freebsd13"),
73-
Some(14) if libc_ci => set_cfg("freebsd14"),
74-
Some(15) if libc_ci => set_cfg("freebsd15"),
75-
Some(_) | None => set_cfg("freebsd11"),
68+
let which_freebsd = if libc_ci {
69+
which_freebsd().unwrap_or(11)
70+
} else if rustc_dep_of_std {
71+
12
72+
} else {
73+
11
74+
};
75+
match which_freebsd {
76+
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
77+
10 => set_cfg("freebsd10"),
78+
11 => set_cfg("freebsd11"),
79+
12 => set_cfg("freebsd12"),
80+
13 => set_cfg("freebsd13"),
81+
14 => set_cfg("freebsd14"),
82+
_ => set_cfg("freebsd15"),
7683
}
7784

7885
match emcc_version_code() {

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,6 +2576,7 @@ fn test_freebsd(target: &str) {
25762576
// skip those that are manually verified
25772577
match name {
25782578
// FIXME: https://github.com/rust-lang/libc/issues/1272
2579+
// Also, `execvpe` is introduced in FreeBSD 14.1
25792580
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
25802581

25812582
// The `uname` function in the `utsname.h` FreeBSD header is a C

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ eui64_hostton
18701870
eui64_ntoa
18711871
eui64_ntohost
18721872
exect
1873+
execvpe
18731874
execvP
18741875
explicit_bzero
18751876
extattr_delete_fd

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,6 +5648,12 @@ extern "C" {
56485648
) -> ::c_int;
56495649
pub fn closefrom(lowfd: ::c_int);
56505650
pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int;
5651+
5652+
pub fn execvpe(
5653+
file: *const ::c_char,
5654+
argv: *const *const ::c_char,
5655+
envp: *const *const ::c_char,
5656+
) -> ::c_int;
56515657
}
56525658

56535659
#[link(name = "memstat")]

0 commit comments

Comments
 (0)