Skip to content

Commit dbedd4a

Browse files
devnexentgross35
authored andcommitted
freebsd kcmp call support.
(backport <rust-lang#3746>) (cherry picked from commit 68ebe1d)
1 parent 3f102f3 commit dbedd4a

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

libc-test/build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -2510,6 +2510,13 @@ fn test_freebsd(target: &str) {
25102510
true
25112511
}
25122512

2513+
// Added in FreeBSD 14.1
2514+
"KCMP_FILE" | "KCMP_FILEOBJ" | "KCMP_FILES" | "KCMP_SIGHAND" | "KCMP_VM"
2515+
if Some(14) > freebsd_ver =>
2516+
{
2517+
true
2518+
}
2519+
25132520
// FIXME: Removed in FreeBSD 15:
25142521
"LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true,
25152522

@@ -2626,6 +2633,9 @@ fn test_freebsd(target: &str) {
26262633
true
26272634
}
26282635

2636+
// Those are introduced in FreeBSD 14.1.
2637+
"kcmp" => true,
2638+
26292639
_ => false,
26302640
}
26312641
});

libc-test/semver/freebsd.txt

+6
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,11 @@ JAIL_SYS_DISABLE
687687
JAIL_SYS_INHERIT
688688
JAIL_SYS_NEW
689689
JAIL_UPDATE
690+
KCMP_FILE
691+
KCMP_FILEOBJ
692+
KCMP_FILES
693+
KCMP_SIGHAND
694+
KCMP_VM
690695
KENV_GET
691696
KENV_SET
692697
KENV_UNSET
@@ -1974,6 +1979,7 @@ jail_get
19741979
jail_remove
19751980
jail_set
19761981
jrand48
1982+
kcmp
19771983
kevent
19781984
key_t
19791985
killpg

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

+14
Original file line numberDiff line numberDiff line change
@@ -4923,6 +4923,12 @@ pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
49234923
pub const TFD_TIMER_ABSTIME: ::c_int = 0x01;
49244924
pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 0x02;
49254925

4926+
pub const KCMP_FILE: ::c_int = 100;
4927+
pub const KCMP_FILEOBJ: ::c_int = 101;
4928+
pub const KCMP_FILES: ::c_int = 102;
4929+
pub const KCMP_SIGHAND: ::c_int = 103;
4930+
pub const KCMP_VM: ::c_int = 104;
4931+
49264932
cfg_if! {
49274933
if #[cfg(libc_const_extern_fn)] {
49284934
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
@@ -5648,6 +5654,14 @@ extern "C" {
56485654
) -> ::c_int;
56495655
pub fn closefrom(lowfd: ::c_int);
56505656
pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int;
5657+
5658+
pub fn kcmp(
5659+
pid1: ::pid_t,
5660+
pid2: ::pid_t,
5661+
type_: ::c_int,
5662+
idx1: ::c_ulong,
5663+
idx2: ::c_ulong,
5664+
) -> ::c_int;
56515665
}
56525666

56535667
#[link(name = "memstat")]

0 commit comments

Comments
 (0)