Skip to content

Commit 06263a7

Browse files
committed
Fixes tests on Solaris
1 parent 72cb7aa commit 06263a7

File tree

9 files changed

+215
-40
lines changed

9 files changed

+215
-40
lines changed

libc-test/build.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,6 @@ fn test_solarish(target: &str) {
795795
"stdlib.h",
796796
"string.h",
797797
"sys/auxv.h",
798-
"sys/epoll.h",
799-
"sys/eventfd.h",
800798
"sys/file.h",
801799
"sys/filio.h",
802800
"sys/ioctl.h",
@@ -836,6 +834,19 @@ fn test_solarish(target: &str) {
836834
"wchar.h",
837835
}
838836

837+
if is_illumos {
838+
headers! { cfg:
839+
"sys/epoll.h",
840+
"sys/eventfd.h",
841+
}
842+
}
843+
844+
if is_solaris {
845+
headers! { cfg:
846+
"sys/lgrp_user_impl.h",
847+
}
848+
}
849+
839850
cfg.skip_type(move |ty| match ty {
840851
"sighandler_t" => true,
841852
_ => false,
@@ -885,7 +896,7 @@ fn test_solarish(target: &str) {
885896
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
886897
// defined on older systems. It is, however, safe to use on systems which do not
887898
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)
888-
"EPOLLEXCLUSIVE" => true,
899+
"EPOLLEXCLUSIVE" if is_illumos => true,
889900

890901
_ => false,
891902
});
@@ -977,7 +988,7 @@ fn test_solarish(target: &str) {
977988
// These functions may return int or void depending on the exact
978989
// configuration of the compilation environment, but the return
979990
// value is not useful (always 0) so we can ignore it:
980-
"setservent" | "endservent" if is_illumos => true,
991+
"setservent" | "endservent" => true,
981992

982993
// Following illumos#3729, getifaddrs was changed to a
983994
// redefine_extname symbol in order to preserve compatibility.

libc-test/semver/TODO-unix.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@
33
getpwuid_r
44
pthread_atfork
55
pthread_sigmask
6+
# * Solaris is missing flock(2)
7+
LOCK_EX
8+
LOCK_NB
9+
LOCK_SH
10+
LOCK_UN

libc-test/semver/unix.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ ISTRIP
184184
IXANY
185185
IXOFF
186186
IXON
187-
LOCK_EX
188-
LOCK_NB
189-
LOCK_SH
190-
LOCK_UN
191187
LOG_ALERT
192188
LOG_AUTH
193189
LOG_CONS

src/unix/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,8 @@ extern "C" {
602602

603603
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
604604
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
605-
#[cfg_attr(
606-
any(target_os = "illumos", target_os = "solaris"),
607-
link_name = "__xnet_socket"
608-
)]
605+
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
606+
#[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
609607
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
610608
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
611609
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
@@ -891,6 +889,7 @@ extern "C" {
891889
pub fn getppid() -> pid_t;
892890
pub fn getuid() -> uid_t;
893891
pub fn isatty(fd: ::c_int) -> ::c_int;
892+
#[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
894893
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
895894
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
896895
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
@@ -929,7 +928,10 @@ extern "C" {
929928
all(target_os = "macos", target_arch = "x86"),
930929
link_name = "ttyname_r$UNIX2003"
931930
)]
932-
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
931+
#[cfg_attr(
932+
any(target_os = "illumos", target_os = "solaris"),
933+
link_name = "__posix_ttyname_r"
934+
)]
933935
pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
934936
pub fn unlink(c: *const c_char) -> ::c_int;
935937
#[cfg_attr(
@@ -1049,6 +1051,7 @@ extern "C" {
10491051
)]
10501052
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
10511053

1054+
#[cfg(not(target_os = "solaris"))]
10521055
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
10531056

10541057
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
@@ -1350,6 +1353,7 @@ extern "C" {
13501353
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
13511354
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
13521355

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

13551359
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1420,12 +1424,20 @@ cfg_if! {
14201424
if #[cfg(not(any(target_os = "emscripten",
14211425
target_os = "android",
14221426
target_os = "haiku",
1423-
target_os = "nto")))] {
1427+
target_os = "nto",
1428+
target_os = "solaris")))] {
14241429
extern "C" {
14251430
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
14261431
}
14271432
}
14281433
}
1434+
cfg_if! {
1435+
if #[cfg(target_os = "solaris")] {
1436+
extern "C" {
1437+
pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int;
1438+
}
1439+
}
1440+
}
14291441

14301442
cfg_if! {
14311443
if #[cfg(not(any(target_os = "emscripten",

src/unix/solarish/illumos.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ s! {
2121
}
2222
}
2323

24+
s_no_extra_traits! {
25+
#[cfg_attr(any(
26+
target_arch = "x86", target_arch = "x86_64"),
27+
repr(packed(4))
28+
)]
29+
pub struct epoll_event {
30+
pub events: u32,
31+
pub u64: u64,
32+
}
33+
}
34+
2435
pub const AF_LOCAL: ::c_int = 1; // AF_UNIX
2536
pub const AF_FILE: ::c_int = 1; // AF_UNIX
2637

0 commit comments

Comments
 (0)