Skip to content

Commit eab1ea0

Browse files
committed
Fixes tests on Solaris
1 parent a31cb99 commit eab1ea0

File tree

9 files changed

+473
-271
lines changed

9 files changed

+473
-271
lines changed

libc-test/build.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,6 @@ fn test_solarish(target: &str) {
821821
"stdlib.h",
822822
"string.h",
823823
"sys/auxv.h",
824-
"sys/epoll.h",
825-
"sys/eventfd.h",
826824
"sys/file.h",
827825
"sys/filio.h",
828826
"sys/ioctl.h",
@@ -862,6 +860,19 @@ fn test_solarish(target: &str) {
862860
"wchar.h",
863861
}
864862

863+
if is_illumos {
864+
headers! { cfg:
865+
"sys/epoll.h",
866+
"sys/eventfd.h",
867+
}
868+
}
869+
870+
if is_solaris {
871+
headers! { cfg:
872+
"sys/lgrp_user_impl.h",
873+
}
874+
}
875+
865876
cfg.skip_type(move |ty| match ty {
866877
"sighandler_t" => true,
867878
_ => false,
@@ -911,7 +922,7 @@ fn test_solarish(target: &str) {
911922
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
912923
// defined on older systems. It is, however, safe to use on systems which do not
913924
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)
914-
"EPOLLEXCLUSIVE" => true,
925+
"EPOLLEXCLUSIVE" if is_illumos => true,
915926

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

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

libc-test/semver/TODO-unix.txt

+5
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

-4
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

+22-8
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,8 @@ extern "C" {
606606

607607
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
608608
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
609-
#[cfg_attr(
610-
any(target_os = "illumos", target_os = "solaris"),
611-
link_name = "__xnet_socket"
612-
)]
609+
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
610+
#[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
613611
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
614612
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
615613
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
@@ -895,6 +893,7 @@ extern "C" {
895893
pub fn getppid() -> pid_t;
896894
pub fn getuid() -> uid_t;
897895
pub fn isatty(fd: ::c_int) -> ::c_int;
896+
#[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
898897
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
899898
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
900899
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
@@ -933,7 +932,10 @@ extern "C" {
933932
all(target_os = "macos", target_arch = "x86"),
934933
link_name = "ttyname_r$UNIX2003"
935934
)]
936-
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
935+
#[cfg_attr(
936+
any(target_os = "illumos", target_os = "solaris"),
937+
link_name = "__posix_ttyname_r"
938+
)]
937939
pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
938940
pub fn unlink(c: *const c_char) -> ::c_int;
939941
#[cfg_attr(
@@ -1054,8 +1056,6 @@ extern "C" {
10541056
)]
10551057
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
10561058

1057-
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1058-
10591059
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
10601060
pub fn times(buf: *mut ::tms) -> ::clock_t;
10611061

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

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

13611362
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1426,10 +1427,15 @@ cfg_if! {
14261427
if #[cfg(not(any(target_os = "emscripten",
14271428
target_os = "android",
14281429
target_os = "haiku",
1429-
target_os = "nto")))] {
1430+
target_os = "nto",
1431+
target_os = "solaris")))] {
14301432
extern "C" {
14311433
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
14321434
}
1435+
} else if #[cfg(target_os = "solaris")] {
1436+
extern "C" {
1437+
pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int;
1438+
}
14331439
}
14341440
}
14351441

@@ -1451,6 +1457,14 @@ cfg_if! {
14511457
}
14521458
}
14531459

1460+
cfg_if! {
1461+
if #[cfg(not(target_os = "solaris"))] {
1462+
extern "C" {
1463+
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1464+
}
1465+
}
1466+
}
1467+
14541468
cfg_if! {
14551469
if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
14561470
extern "C" {

0 commit comments

Comments
 (0)