From 790e5c6d3900a475c6ce1dff34e50d4b09d2f74b Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 30 Jan 2024 05:07:47 +0900 Subject: [PATCH] Remove removed items in OpenBSD --- libc-test/build.rs | 24 ------------------------ libc-test/semver/openbsd.txt | 6 ------ src/unix/bsd/mod.rs | 9 ++++++++- src/unix/bsd/netbsdlike/mod.rs | 1 - src/unix/bsd/netbsdlike/netbsd/mod.rs | 2 ++ src/unix/bsd/netbsdlike/openbsd/mod.rs | 16 ---------------- 6 files changed, 10 insertions(+), 48 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 03f72b2e1e973..7d61f27b6d5bf 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -521,38 +521,14 @@ fn test_openbsd(target: &str) { } }); - cfg.skip_const(move |name| { - match name { - // Removed in OpenBSD 6.0 - "KERN_USERMOUNT" | "KERN_ARND" => true, - // Removed in OpenBSD 7.2 - "KERN_NSELCOLL" => true, - // Good chance it's going to be wrong depending on the host release - "KERN_MAXID" | "NET_RT_MAXID" => true, - "EV_SYSFLAGS" => true, - _ => false, - } - }); - cfg.skip_fn(move |name| { match name { // FIXME: https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" | "execvpe" => true, - // Removed in OpenBSD 6.5 - // https://marc.info/?l=openbsd-cvs&m=154723400730318 - "mincore" => true, - // futex() has volatile arguments, but that doesn't exist in Rust. "futex" => true, - // Available for openBSD 7.3 - "mimmutable" => true, - - // Removed in OpenBSD 7.5 - // https://marc.info/?l=openbsd-cvs&m=170239504300386 - "syscall" => true, - _ => false, } }); diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index fd4563212d60d..afb8afa7f50f0 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -331,7 +331,6 @@ ITIMER_PROF ITIMER_REAL ITIMER_VIRTUAL KERN_ARGMAX -KERN_ARND KERN_AUDIO KERN_BOOTTIME KERN_CACHEPCT @@ -357,7 +356,6 @@ KERN_JOB_CONTROL KERN_MALLOCSTATS KERN_MAXCLUSTERS KERN_MAXFILES -KERN_MAXID KERN_MAXLOCKSPERUID KERN_MAXPARTITIONS KERN_MAXPROC @@ -372,7 +370,6 @@ KERN_NFILES KERN_NGROUPS KERN_NOSUIDCOREDUMP KERN_NPROCS -KERN_NSELCOLL KERN_NTHREADS KERN_NUMVNODES KERN_OSRELEASE @@ -422,7 +419,6 @@ KERN_TIMECOUNTER KERN_TIMEOUT_STATS KERN_TTY KERN_TTYCOUNT -KERN_USERMOUNT KERN_VERSION KERN_WATCHDOG KVE_ADV_NORMAL @@ -1129,7 +1125,6 @@ memmem memrchr mfs_args mimmutable -mincore mkdirat mkfifoat mknodat @@ -1279,7 +1274,6 @@ strndup strsignal strtonum sync -syscall sysctl tcp_info telldir diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 435ffc39cd8d2..e2b5121b03911 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -632,7 +632,6 @@ extern "C" { pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn kqueue() -> ::c_int; pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; - pub fn syscall(num: ::c_int, ...) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] pub fn getpwent() -> *mut passwd; pub fn setpwent(); @@ -916,6 +915,14 @@ extern "C" { ) -> ::size_t; } +cfg_if! { + if #[cfg(not(target_os = "openbsd"))] { + extern "C" { + pub fn syscall(num: ::c_int, ...) -> ::c_int; + } + } +} + cfg_if! { if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] { mod apple; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index e92cf65940141..b9780f6f77b6a 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -672,7 +672,6 @@ extern "C" { addrlen: *mut ::socklen_t, flags: ::c_int, ) -> ::c_int; - pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")] pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")] diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 2f383bfb9b9e9..8eab8e4233da4 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2902,6 +2902,8 @@ extern "C" { result: *mut *mut ::group, ) -> ::c_int; + pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; + pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int; pub fn getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx; pub fn updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 145f46d0ba0f2..357662547b8e3 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1248,12 +1248,6 @@ pub const NET_RT_IFLIST: ::c_int = 3; pub const NET_RT_STATS: ::c_int = 4; pub const NET_RT_TABLE: ::c_int = 5; pub const NET_RT_IFNAMES: ::c_int = 6; -#[doc(hidden)] -#[deprecated( - since = "0.2.95", - note = "Possibly increasing over the releases and might not be so used in the field" -)] -pub const NET_RT_MAXID: ::c_int = 7; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; @@ -1554,21 +1548,16 @@ pub const KERN_NTHREADS: ::c_int = 26; pub const KERN_OSVERSION: ::c_int = 27; pub const KERN_SOMAXCONN: ::c_int = 28; pub const KERN_SOMINCONN: ::c_int = 29; -#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] -pub const KERN_USERMOUNT: ::c_int = 30; pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; pub const KERN_FSYNC: ::c_int = 33; pub const KERN_SYSVMSG: ::c_int = 34; pub const KERN_SYSVSEM: ::c_int = 35; pub const KERN_SYSVSHM: ::c_int = 36; -#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] -pub const KERN_ARND: ::c_int = 37; pub const KERN_MSGBUFSIZE: ::c_int = 38; pub const KERN_MALLOCSTATS: ::c_int = 39; pub const KERN_CPTIME: ::c_int = 40; pub const KERN_NCHSTATS: ::c_int = 41; pub const KERN_FORKSTAT: ::c_int = 42; -pub const KERN_NSELCOLL: ::c_int = 43; pub const KERN_TTY: ::c_int = 44; pub const KERN_CCPU: ::c_int = 45; pub const KERN_FSCALE: ::c_int = 46; @@ -1608,11 +1597,6 @@ pub const KERN_AUDIO: ::c_int = 84; pub const KERN_CPUSTATS: ::c_int = 85; pub const KERN_PFSTATUS: ::c_int = 86; pub const KERN_TIMEOUT_STATS: ::c_int = 87; -#[deprecated( - since = "0.2.95", - note = "Possibly increasing over the releases and might not be so used in the field" -)] -pub const KERN_MAXID: ::c_int = 88; pub const KERN_PROC_ALL: ::c_int = 0; pub const KERN_PROC_PID: ::c_int = 1;