Skip to content

Commit

Permalink
Merge pull request #3852 from tgross35/backport-onion
Browse files Browse the repository at this point in the history
[0.2] Backport two FreeBSD-related pull requests
  • Loading branch information
tgross35 authored Aug 17, 2024
2 parents 64ee9df + 9e43d14 commit 6d2b8a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
23 changes: 15 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,21 @@ fn main() {
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
match which_freebsd() {
Some(10) if libc_ci => set_cfg("freebsd10"),
Some(11) if libc_ci => set_cfg("freebsd11"),
Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"),
Some(13) if libc_ci => set_cfg("freebsd13"),
Some(14) if libc_ci => set_cfg("freebsd14"),
Some(15) if libc_ci => set_cfg("freebsd15"),
Some(_) | None => set_cfg("freebsd11"),
let which_freebsd = if libc_ci {
which_freebsd().unwrap_or(11)
} else if rustc_dep_of_std {
12
} else {
11
};
match which_freebsd {
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
10 => set_cfg("freebsd10"),
11 => set_cfg("freebsd11"),
12 => set_cfg("freebsd12"),
13 => set_cfg("freebsd13"),
14 => set_cfg("freebsd14"),
_ => set_cfg("freebsd15"),
}

match emcc_version_code() {
Expand Down
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,7 @@ fn test_freebsd(target: &str) {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
// Also, `execvpe` is introduced in FreeBSD 14.1
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,

// The `uname` function in the `utsname.h` FreeBSD header is a C
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1870,6 +1870,7 @@ eui64_hostton
eui64_ntoa
eui64_ntohost
exect
execvpe
execvP
explicit_bzero
extattr_delete_fd
Expand Down
6 changes: 6 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5648,6 +5648,12 @@ extern "C" {
) -> ::c_int;
pub fn closefrom(lowfd: ::c_int);
pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int;

pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
}

#[link(name = "memstat")]
Expand Down

0 comments on commit 6d2b8a0

Please sign in to comment.