From 9fc257454814ea12610a933ccc83033151c413b7 Mon Sep 17 00:00:00 2001 From: Greg V <greg@unrelenting.technology> Date: Wed, 1 Jul 2020 15:08:57 +0300 Subject: [PATCH] FreeBSD: chase CTL_UNSPEC to CTL_SYSCTL, IPPROTO_SEP to IPPROTO_DCCP renames Plus, add new constants for sysctls that give names to existing magic numbers. https://reviews.freebsd.org/rS350749 https://reviews.freebsd.org/rS352486 --- libc-test/build.rs | 16 ++++++++++++++++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 21 ++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 81137d8e..07d80ce3 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1810,6 +1810,22 @@ fn test_freebsd(target: &str) { // base system anyway. "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID" | "USER_MAXID" => true, + // This was renamed in FreeBSD 12.2 and 13 (r352486). + "CTL_UNSPEC" | "CTL_SYSCTL" => true, + + // These were added in FreeBSD 12.2 and 13 (r352486), + // but they are just names for magic numbers that existed for ages. + "CTL_SYSCTL_DEBUG" + | "CTL_SYSCTL_NAME" + | "CTL_SYSCTL_NEXT" + | "CTL_SYSCTL_NAME2OID" + | "CTL_SYSCTL_OIDFMT" + | "CTL_SYSCTL_OIDDESCR" + | "CTL_SYSCTL_OIDLABEL" => true, + + // This was renamed in FreeBSD 12.2 and 13 (r350749). + "IPPROTO_SEP" | "IPPROTO_DCCP" => true, + _ => false, } }); diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 1e7f1566..968fe4b3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -442,7 +442,13 @@ pub const CLOCK_SECOND: ::clockid_t = 13; pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14; pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15; +#[doc(hidden)] +#[deprecated( + since = "0.2.72", + note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead" +)] pub const CTL_UNSPEC: ::c_int = 0; +pub const CTL_SYSCTL: ::c_int = 0; pub const CTL_KERN: ::c_int = 1; pub const CTL_VM: ::c_int = 2; pub const CTL_VFS: ::c_int = 3; @@ -452,6 +458,13 @@ pub const CTL_HW: ::c_int = 6; pub const CTL_MACHDEP: ::c_int = 7; pub const CTL_USER: ::c_int = 8; pub const CTL_P1003_1B: ::c_int = 9; +pub const CTL_SYSCTL_DEBUG: ::c_int = 0; +pub const CTL_SYSCTL_NAME: ::c_int = 1; +pub const CTL_SYSCTL_NEXT: ::c_int = 2; +pub const CTL_SYSCTL_NAME2OID: ::c_int = 3; +pub const CTL_SYSCTL_OIDFMT: ::c_int = 4; +pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5; +pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6; pub const KERN_OSTYPE: ::c_int = 1; pub const KERN_OSRELEASE: ::c_int = 2; pub const KERN_OSREV: ::c_int = 3; @@ -769,8 +782,14 @@ pub const IPPROTO_BLT: ::c_int = 30; pub const IPPROTO_NSP: ::c_int = 31; /// Merit Internodal pub const IPPROTO_INP: ::c_int = 32; -/// Sequential Exchange +#[doc(hidden)] +#[deprecated( + since = "0.2.72", + note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead" +)] pub const IPPROTO_SEP: ::c_int = 33; +/// Datagram Congestion Control Protocol +pub const IPPROTO_DCCP: ::c_int = 33; /// Third Party Connect pub const IPPROTO_3PC: ::c_int = 34; /// InterDomain Policy Routing -- GitLab