Skip to content

Commit

Permalink
Fixes tests on Solaris
Browse files Browse the repository at this point in the history
  • Loading branch information
psumbera committed Oct 15, 2024
1 parent a31cb99 commit 3bbc12c
Show file tree
Hide file tree
Showing 9 changed files with 474 additions and 271 deletions.
19 changes: 15 additions & 4 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,6 @@ fn test_solarish(target: &str) {
"stdlib.h",
"string.h",
"sys/auxv.h",
"sys/epoll.h",
"sys/eventfd.h",
"sys/file.h",
"sys/filio.h",
"sys/ioctl.h",
Expand Down Expand Up @@ -862,6 +860,19 @@ fn test_solarish(target: &str) {
"wchar.h",
}

if is_illumos {
headers! { cfg:
"sys/epoll.h",
"sys/eventfd.h",
}
}

if is_solaris {
headers! { cfg:
"sys/lgrp_user_impl.h",
}
}

cfg.skip_type(move |ty| match ty {
"sighandler_t" => true,
_ => false,
Expand Down Expand Up @@ -911,7 +922,7 @@ fn test_solarish(target: &str) {
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
// defined on older systems. It is, however, safe to use on systems which do not
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)
"EPOLLEXCLUSIVE" => true,
"EPOLLEXCLUSIVE" if is_illumos => true,

_ => false,
});
Expand Down Expand Up @@ -1003,7 +1014,7 @@ fn test_solarish(target: &str) {
// These functions may return int or void depending on the exact
// configuration of the compilation environment, but the return
// value is not useful (always 0) so we can ignore it:
"setservent" | "endservent" if is_illumos => true,
"setservent" | "endservent" => true,

// Following illumos#3729, getifaddrs was changed to a
// redefine_extname symbol in order to preserve compatibility.
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/TODO-unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
getpwuid_r
pthread_atfork
pthread_sigmask
# * Solaris is missing flock(2)
LOCK_EX
LOCK_NB
LOCK_SH
LOCK_UN
4 changes: 0 additions & 4 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ ISTRIP
IXANY
IXOFF
IXON
LOCK_EX
LOCK_NB
LOCK_SH
LOCK_UN
LOG_ALERT
LOG_AUTH
LOG_CONS
Expand Down
30 changes: 22 additions & 8 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,8 @@ extern "C" {

#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__xnet_socket"
)]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
#[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
Expand Down Expand Up @@ -895,6 +893,7 @@ extern "C" {
pub fn getppid() -> pid_t;
pub fn getuid() -> uid_t;
pub fn isatty(fd: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
Expand Down Expand Up @@ -933,7 +932,10 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "ttyname_r$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
#[cfg_attr(
any(target_os = "illumos", target_os = "solaris"),
link_name = "__posix_ttyname_r"
)]
pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn unlink(c: *const c_char) -> ::c_int;
#[cfg_attr(
Expand Down Expand Up @@ -1054,8 +1056,6 @@ extern "C" {
)]
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;

pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;

#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
pub fn times(buf: *mut ::tms) -> ::clock_t;

Expand Down Expand Up @@ -1356,6 +1356,7 @@ extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
pub fn sigpending(set: *mut sigset_t) -> ::c_int;

#[cfg_attr(target_os = "solaris", link_name = "__sysconf_xpg7")]
pub fn sysconf(name: ::c_int) -> ::c_long;

pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
Expand Down Expand Up @@ -1426,10 +1427,15 @@ cfg_if! {
if #[cfg(not(any(target_os = "emscripten",
target_os = "android",
target_os = "haiku",
target_os = "nto")))] {
target_os = "nto",
target_os = "solaris")))] {
extern "C" {
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
}
} else if #[cfg(target_os = "solaris")] {
extern "C" {
pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int;
}
}
}

Expand All @@ -1451,6 +1457,14 @@ cfg_if! {
}
}

cfg_if! {
if #[cfg(not(target_os = "solaris"))] {
extern "C" {
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
}
}
}

cfg_if! {
if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
extern "C" {
Expand Down
Loading

0 comments on commit 3bbc12c

Please sign in to comment.