Skip to content

Commit

Permalink
Merge pull request rust-lang#3567 from JohnTitor/rm-removed-items-ope…
Browse files Browse the repository at this point in the history
…nbsd

Remove removed items in OpenBSD
  • Loading branch information
JohnTitor authored Feb 3, 2024
2 parents 8a846aa + 790e5c6 commit 7d19eed
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 48 deletions.
24 changes: 0 additions & 24 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
});
Expand Down
6 changes: 0 additions & 6 deletions libc-test/semver/openbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ ITIMER_PROF
ITIMER_REAL
ITIMER_VIRTUAL
KERN_ARGMAX
KERN_ARND
KERN_AUDIO
KERN_BOOTTIME
KERN_CACHEPCT
Expand All @@ -357,7 +356,6 @@ KERN_JOB_CONTROL
KERN_MALLOCSTATS
KERN_MAXCLUSTERS
KERN_MAXFILES
KERN_MAXID
KERN_MAXLOCKSPERUID
KERN_MAXPARTITIONS
KERN_MAXPROC
Expand All @@ -372,7 +370,6 @@ KERN_NFILES
KERN_NGROUPS
KERN_NOSUIDCOREDUMP
KERN_NPROCS
KERN_NSELCOLL
KERN_NTHREADS
KERN_NUMVNODES
KERN_OSRELEASE
Expand Down Expand Up @@ -422,7 +419,6 @@ KERN_TIMECOUNTER
KERN_TIMEOUT_STATS
KERN_TTY
KERN_TTYCOUNT
KERN_USERMOUNT
KERN_VERSION
KERN_WATCHDOG
KVE_ADV_NORMAL
Expand Down Expand Up @@ -1129,7 +1125,6 @@ memmem
memrchr
mfs_args
mimmutable
mincore
mkdirat
mkfifoat
mknodat
Expand Down Expand Up @@ -1279,7 +1274,6 @@ strndup
strsignal
strtonum
sync
syscall
sysctl
tcp_info
telldir
Expand Down
9 changes: 8 additions & 1 deletion src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 2 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7d19eed

Please sign in to comment.