Skip to content

Commit

Permalink
Auto merge of #3124 - valpackett:fbsd, r=JohnTitor
Browse files Browse the repository at this point in the history
FreeBSD: add AT_RESOLVE_BENEATH, Linux-compatible clock aliases

- sorry for the spam xD *now* I should be done with that area of the API…
- +mirror one other thing that [was done](https://reviews.freebsd.org/D30988) in the headers to reduce portability annoyance :)
  • Loading branch information
bors committed Feb 21, 2023
2 parents 9e63320 + 6965951 commit 90531f6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,14 +2074,22 @@ fn test_freebsd(target: &str) {
// These constants were introduced in FreeBSD 13:
"EFD_CLOEXEC" | "EFD_NONBLOCK" | "EFD_SEMAPHORE" if Some(13) > freebsd_ver => true,

// This constant was introduced in FreeBSD 12:
"O_RESOLVE_BENEATH" if Some(12) > freebsd_ver => true,
// These constants were introduced in FreeBSD 12:
"AT_RESOLVE_BENEATH" | "O_RESOLVE_BENEATH" if Some(12) > freebsd_ver => true,

// These constants were introduced in FreeBSD 13:
"O_DSYNC" | "O_PATH" | "O_EMPTY_PATH" | "AT_EMPTY_PATH" if Some(13) > freebsd_ver => {
true
}

// These aliases were introduced in FreeBSD 13:
// (note however that the constants themselves work on any version)
"CLOCK_BOOTTIME" | "CLOCK_REALTIME_COARSE" | "CLOCK_MONOTONIC_COARSE"
if Some(13) > freebsd_ver =>
{
true
}

// FIXME: These are deprecated - remove in a couple of releases.
// These constants were removed in FreeBSD 11 (svn r273250) but will
// still be accepted and ignored at runtime.
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ AT_PHDR
AT_PHENT
AT_PHNUM
AT_REMOVEDIR
AT_RESOLVE_BENEATH
AT_SYMLINK_FOLLOW
AT_SYMLINK_NOFOLLOW
AT_UID
Expand Down Expand Up @@ -148,10 +149,13 @@ CLD_EXITED
CLD_KILLED
CLD_STOPPED
CLD_TRAPPED
CLOCK_BOOTTIME
CLOCK_MONOTONIC_COARSE
CLOCK_MONOTONIC_FAST
CLOCK_MONOTONIC_PRECISE
CLOCK_PROCESS_CPUTIME_ID
CLOCK_PROF
CLOCK_REALTIME_COARSE
CLOCK_REALTIME_FAST
CLOCK_REALTIME_PRECISE
CLOCK_SECOND
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,7 @@ pub const AT_EACCESS: ::c_int = 0x100;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
pub const AT_REMOVEDIR: ::c_int = 0x800;
pub const AT_RESOLVE_BENEATH: ::c_int = 0x2000;
pub const AT_EMPTY_PATH: ::c_int = 0x4000;

pub const AT_NULL: ::c_int = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,12 +824,15 @@ pub const CLOCK_VIRTUAL: ::clockid_t = 1;
pub const CLOCK_PROF: ::clockid_t = 2;
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
pub const CLOCK_UPTIME: ::clockid_t = 5;
pub const CLOCK_BOOTTIME: ::clockid_t = CLOCK_UPTIME;
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
pub const CLOCK_REALTIME_COARSE: ::clockid_t = CLOCK_REALTIME_FAST;
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = CLOCK_MONOTONIC_FAST;
pub const CLOCK_SECOND: ::clockid_t = 13;
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
Expand Down

0 comments on commit 90531f6

Please sign in to comment.