Skip to content

Commit 13273fe

Browse files
valpacketttatref
authored andcommitted
FreeBSD: move newly introduced functions in all versions back to root
According to rust-lang#3023, new ABI did not need to be hidden away under cfg(freebsdXX) flags, only changed ABI!
1 parent 523ea31 commit 13273fe

File tree

6 files changed

+30
-51
lines changed

6 files changed

+30
-51
lines changed

libc-test/build.rs

Lines changed: 11 additions & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 0 additions & 14 deletions
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

Lines changed: 0 additions & 17 deletions
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

Lines changed: 0 additions & 17 deletions
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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5102,6 +5102,12 @@ extern "C" {
51025102
pub fn getpagesizes(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int;
51035103

51045104
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
5105+
pub fn clock_nanosleep(
5106+
clk_id: ::clockid_t,
5107+
flags: ::c_int,
5108+
rqtp: *const ::timespec,
5109+
rmtp: *mut ::timespec,
5110+
) -> ::c_int;
51055111

51065112
pub fn shm_create_largepage(
51075113
path: *const ::c_char,
@@ -5118,6 +5124,17 @@ extern "C" {
51185124
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
51195125
pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int;
51205126

5127+
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
5128+
5129+
pub fn fdatasync(fd: ::c_int) -> ::c_int;
5130+
5131+
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
5132+
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
5133+
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
5134+
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
5135+
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
5136+
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
5137+
51215138
pub fn _umtx_op(
51225139
obj: *mut ::c_void,
51235140
op: ::c_int,

0 commit comments

Comments
 (0)