Skip to content

Commit 90531f6

Browse files
committed
Auto merge of #3124 - valpackett:fbsd, r=JohnTitor
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 :)
2 parents 9e63320 + 6965951 commit 90531f6

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

libc-test/build.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,14 +2074,22 @@ fn test_freebsd(target: &str) {
20742074
// These constants were introduced in FreeBSD 13:
20752075
"EFD_CLOEXEC" | "EFD_NONBLOCK" | "EFD_SEMAPHORE" if Some(13) > freebsd_ver => true,
20762076

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

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

2085+
// These aliases were introduced in FreeBSD 13:
2086+
// (note however that the constants themselves work on any version)
2087+
"CLOCK_BOOTTIME" | "CLOCK_REALTIME_COARSE" | "CLOCK_MONOTONIC_COARSE"
2088+
if Some(13) > freebsd_ver =>
2089+
{
2090+
true
2091+
}
2092+
20852093
// FIXME: These are deprecated - remove in a couple of releases.
20862094
// These constants were removed in FreeBSD 11 (svn r273250) but will
20872095
// still be accepted and ignored at runtime.

libc-test/semver/freebsd.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ AT_PHDR
100100
AT_PHENT
101101
AT_PHNUM
102102
AT_REMOVEDIR
103+
AT_RESOLVE_BENEATH
103104
AT_SYMLINK_FOLLOW
104105
AT_SYMLINK_NOFOLLOW
105106
AT_UID
@@ -148,10 +149,13 @@ CLD_EXITED
148149
CLD_KILLED
149150
CLD_STOPPED
150151
CLD_TRAPPED
152+
CLOCK_BOOTTIME
153+
CLOCK_MONOTONIC_COARSE
151154
CLOCK_MONOTONIC_FAST
152155
CLOCK_MONOTONIC_PRECISE
153156
CLOCK_PROCESS_CPUTIME_ID
154157
CLOCK_PROF
158+
CLOCK_REALTIME_COARSE
155159
CLOCK_REALTIME_FAST
156160
CLOCK_REALTIME_PRECISE
157161
CLOCK_SECOND

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3737,6 +3737,7 @@ pub const AT_EACCESS: ::c_int = 0x100;
37373737
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
37383738
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
37393739
pub const AT_REMOVEDIR: ::c_int = 0x800;
3740+
pub const AT_RESOLVE_BENEATH: ::c_int = 0x2000;
37403741
pub const AT_EMPTY_PATH: ::c_int = 0x4000;
37413742

37423743
pub const AT_NULL: ::c_int = 0;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,15 @@ pub const CLOCK_VIRTUAL: ::clockid_t = 1;
824824
pub const CLOCK_PROF: ::clockid_t = 2;
825825
pub const CLOCK_MONOTONIC: ::clockid_t = 4;
826826
pub const CLOCK_UPTIME: ::clockid_t = 5;
827+
pub const CLOCK_BOOTTIME: ::clockid_t = CLOCK_UPTIME;
827828
pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
828829
pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
829830
pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
830831
pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
832+
pub const CLOCK_REALTIME_COARSE: ::clockid_t = CLOCK_REALTIME_FAST;
831833
pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
832834
pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
835+
pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = CLOCK_MONOTONIC_FAST;
833836
pub const CLOCK_SECOND: ::clockid_t = 13;
834837
pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
835838
pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;

0 commit comments

Comments
 (0)