diff --git a/libc-test/build.rs b/libc-test/build.rs index a10756380bb83..7ef89cd52e23d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2074,6 +2074,12 @@ 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 13: + "O_DSYNC" | "O_PATH" | "O_EMPTY_PATH" 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. @@ -2305,9 +2311,6 @@ fn test_freebsd(target: &str) { // FIXME: https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - // `fspacectl` was introduced in FreeBSD 14 - "fspacectl" if Some(14) > freebsd_ver => true, - // The `uname` function in the `utsname.h` FreeBSD header is a C // inline function (has no symbol) that calls the `__xuname` symbol. // Therefore the function pointer comparison does not make sense for it. @@ -2319,26 +2322,36 @@ fn test_freebsd(target: &str) { // https://github.com/gnzlbg/ctest/issues/68 "lio_listio" => true, - // Those are introduced in FreeBSD 14. - "sched_getaffinity" | "sched_setaffinity" | "sched_getcpu" - if Some(14) > freebsd_ver => + // Those are introduced in FreeBSD 12. + "clock_nanosleep" | "getrandom" | "elf_aux_info" | "setproctitle_fast" + | "timingsafe_bcmp" | "timingsafe_memcmp" + if Some(12) > freebsd_ver => { true } - // This is not available in FreeBSD 12. - "SOCKCRED2SIZE" if Some(13) > freebsd_ver => true, - - // Those are not available in FreeBSD 12. - "memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => { + // Those are introduced in FreeBSD 13. + "memfd_create" + | "shm_create_largepage" + | "shm_rename" + | "getentropy" + | "eventfd" + | "SOCKCRED2SIZE" + | "getlocalbase" + | "aio_readv" + | "aio_writev" + | "copy_file_range" + if Some(13) > freebsd_ver => + { true } - // Added in FreeBSD 13. - "getlocalbase" if Some(13) > freebsd_ver => true, - "aio_readv" if Some(13) > freebsd_ver => true, - "aio_writev" if Some(13) > freebsd_ver => true, - "copy_file_range" if Some(13) > freebsd_ver => true, + // Those are introduced in FreeBSD 14. + "sched_getaffinity" | "sched_setaffinity" | "sched_getcpu" | "fspacectl" + if Some(14) > freebsd_ver => + { + true + } _ => false, } diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 706a35fe19735..c432244327f59 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -819,14 +819,20 @@ ONOEOT OXTABS O_ASYNC O_DIRECT +O_DSYNC +O_EMPTY_PATH O_EXEC O_EXLOCK O_FSYNC O_NDELAY O_NOCTTY +O_PATH +O_RESOLVE_BENEATH +O_SEARCH O_SHLOCK O_SYNC O_TTY_INIT +O_VERIFY PD_ALLOWED_AT_FORK PD_CLOEXEC PD_DAEMON diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 563c0f936ffef..f2d170fb28864 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -462,8 +462,8 @@ extern "C" { msgflg: ::c_int, ) -> ::c_int; - pub fn fdatasync(fd: ::c_int) -> ::c_int; - + // Type of `path` argument changed from `const void*` to `void*` + // in FreeBSD 12 pub fn dirname(path: *const ::c_char) -> *mut ::c_char; pub fn basename(path: *const ::c_char) -> *mut ::c_char; } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index df00b6c1d63fe..5cd4eff26fc04 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -473,20 +473,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 72a38dc226851..56564eeb454f0 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -492,23 +492,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn cpuset_getdomain( level: ::cpulevel_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 115b47764e69e..d60f1a174f1d5 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -492,23 +492,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn cpuset_getdomain( level: ::cpulevel_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index a3e094248562e..7c18f676df4b6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2523,8 +2523,14 @@ pub const SF_USER_READAHEAD: ::c_int = 0x00000008; pub const SF_NOCACHE: ::c_int = 0x00000010; pub const O_CLOEXEC: ::c_int = 0x00100000; pub const O_DIRECTORY: ::c_int = 0x00020000; +pub const O_DSYNC: ::c_int = 0x01000000; +pub const O_EMPTY_PATH: ::c_int = 0x02000000; pub const O_EXEC: ::c_int = 0x00040000; +pub const O_PATH: ::c_int = 0x00400000; +pub const O_RESOLVE_BENEATH: ::c_int = 0x00800000; +pub const O_SEARCH: ::c_int = O_EXEC; pub const O_TTY_INIT: ::c_int = 0x00080000; +pub const O_VERIFY: ::c_int = 0x00200000; pub const F_GETLK: ::c_int = 11; pub const F_SETLK: ::c_int = 12; pub const F_SETLKW: ::c_int = 13; @@ -5096,6 +5102,12 @@ extern "C" { pub fn getpagesizes(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int; pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int; + pub fn clock_nanosleep( + clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec, + ) -> ::c_int; pub fn shm_create_largepage( path: *const ::c_char, @@ -5112,6 +5124,17 @@ extern "C" { pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int; pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn fdatasync(fd: ::c_int) -> ::c_int; + + pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; + pub fn setproctitle_fast(fmt: *const ::c_char, ...); + pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn _umtx_op( obj: *mut ::c_void, op: ::c_int,