Skip to content

Commit a4fd9d3

Browse files
committed
FreeBSD: move newly introduced functions in all versions back to root
According to #3023, new ABI did not need to be hidden away under cfg(freebsdXX) flags, only changed ABI!
1 parent 196d497 commit a4fd9d3

File tree

6 files changed

+30
-51
lines changed

6 files changed

+30
-51
lines changed

libc-test/build.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,14 @@ fn test_freebsd(target: &str) {
23252325
// https://github.com/gnzlbg/ctest/issues/68
23262326
"lio_listio" => true,
23272327

2328+
// Those introduced in FreeBSD 12.
2329+
"clock_nanosleep" | "getrandom" | "elf_aux_info" | "setproctitle_fast"
2330+
| "timingsafe_bcmp" | "timingsafe_memcmp"
2331+
if Some(12) > freebsd_ver =>
2332+
{
2333+
true
2334+
}
2335+
23282336
// Those are introduced in FreeBSD 14.
23292337
"sched_getaffinity" | "sched_setaffinity" | "sched_getcpu"
23302338
if Some(14) > freebsd_ver =>
@@ -2336,7 +2344,9 @@ fn test_freebsd(target: &str) {
23362344
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,
23372345

23382346
// Those are not available in FreeBSD 12.
2339-
"memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => {
2347+
"memfd_create" | "shm_create_largepage" | "shm_rename" | "getentropy" | "eventfd"
2348+
if Some(13) > freebsd_ver =>
2349+
{
23402350
true
23412351
}
23422352

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ extern "C" {
462462
msgflg: ::c_int,
463463
) -> ::c_int;
464464

465-
pub fn fdatasync(fd: ::c_int) -> ::c_int;
466-
465+
// Type of `path` argument changed from `const void*` to `void*`
466+
// in FreeBSD 12
467467
pub fn dirname(path: *const ::c_char) -> *mut ::c_char;
468468
pub fn basename(path: *const ::c_char) -> *mut ::c_char;
469469
}

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

-14
Original file line numberDiff line numberDiff line change
@@ -473,20 +473,6 @@ extern "C" {
473473
msgtyp: ::c_long,
474474
msgflg: ::c_int,
475475
) -> ::ssize_t;
476-
pub fn clock_nanosleep(
477-
clk_id: ::clockid_t,
478-
flags: ::c_int,
479-
rqtp: *const ::timespec,
480-
rmtp: *mut ::timespec,
481-
) -> ::c_int;
482-
483-
pub fn fdatasync(fd: ::c_int) -> ::c_int;
484-
485-
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
486-
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
487-
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
488-
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
489-
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
490476

491477
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
492478
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;

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

-17
Original file line numberDiff line numberDiff line change
@@ -492,23 +492,6 @@ extern "C" {
492492
msgtyp: ::c_long,
493493
msgflg: ::c_int,
494494
) -> ::ssize_t;
495-
pub fn clock_nanosleep(
496-
clk_id: ::clockid_t,
497-
flags: ::c_int,
498-
rqtp: *const ::timespec,
499-
rmtp: *mut ::timespec,
500-
) -> ::c_int;
501-
502-
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
503-
504-
pub fn fdatasync(fd: ::c_int) -> ::c_int;
505-
506-
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
507-
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
508-
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
509-
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
510-
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
511-
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
512495

513496
pub fn cpuset_getdomain(
514497
level: ::cpulevel_t,

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

-17
Original file line numberDiff line numberDiff line change
@@ -492,23 +492,6 @@ extern "C" {
492492
msgtyp: ::c_long,
493493
msgflg: ::c_int,
494494
) -> ::ssize_t;
495-
pub fn clock_nanosleep(
496-
clk_id: ::clockid_t,
497-
flags: ::c_int,
498-
rqtp: *const ::timespec,
499-
rmtp: *mut ::timespec,
500-
) -> ::c_int;
501-
502-
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
503-
504-
pub fn fdatasync(fd: ::c_int) -> ::c_int;
505-
506-
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
507-
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
508-
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
509-
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
510-
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
511-
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
512495

513496
pub fn cpuset_getdomain(
514497
level: ::cpulevel_t,

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

+17
Original file line numberDiff line numberDiff line change
@@ -5040,6 +5040,12 @@ extern "C" {
50405040
pub fn getpagesizes(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int;
50415041

50425042
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
5043+
pub fn clock_nanosleep(
5044+
clk_id: ::clockid_t,
5045+
flags: ::c_int,
5046+
rqtp: *const ::timespec,
5047+
rmtp: *mut ::timespec,
5048+
) -> ::c_int;
50435049

50445050
pub fn shm_create_largepage(
50455051
path: *const ::c_char,
@@ -5056,6 +5062,17 @@ extern "C" {
50565062
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
50575063
pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int;
50585064

5065+
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
5066+
5067+
pub fn fdatasync(fd: ::c_int) -> ::c_int;
5068+
5069+
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
5070+
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
5071+
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
5072+
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
5073+
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
5074+
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
5075+
50595076
pub fn _umtx_op(
50605077
obj: *mut ::c_void,
50615078
op: ::c_int,

0 commit comments

Comments
 (0)