Skip to content

Commit ec3c338

Browse files
psumberatgross35
authored andcommitted
Fixes tests on Solaris
1 parent 9ab13fd commit ec3c338

File tree

9 files changed

+474
-271
lines changed

9 files changed

+474
-271
lines changed

libc-test/build.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,6 @@ fn test_solarish(target: &str) {
825825
"stdlib.h",
826826
"string.h",
827827
"sys/auxv.h",
828-
"sys/epoll.h",
829-
"sys/eventfd.h",
830828
"sys/file.h",
831829
"sys/filio.h",
832830
"sys/ioctl.h",
@@ -866,6 +864,19 @@ fn test_solarish(target: &str) {
866864
"wchar.h",
867865
}
868866

867+
if is_illumos {
868+
headers! { cfg:
869+
"sys/epoll.h",
870+
"sys/eventfd.h",
871+
}
872+
}
873+
874+
if is_solaris {
875+
headers! { cfg:
876+
"sys/lgrp_user_impl.h",
877+
}
878+
}
879+
869880
cfg.skip_type(move |ty| match ty {
870881
"sighandler_t" => true,
871882
_ => false,
@@ -915,7 +926,7 @@ fn test_solarish(target: &str) {
915926
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
916927
// defined on older systems. It is, however, safe to use on systems which do not
917928
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)
918-
"EPOLLEXCLUSIVE" => true,
929+
"EPOLLEXCLUSIVE" if is_illumos => true,
919930

920931
_ => false,
921932
});
@@ -1007,7 +1018,7 @@ fn test_solarish(target: &str) {
10071018
// These functions may return int or void depending on the exact
10081019
// configuration of the compilation environment, but the return
10091020
// value is not useful (always 0) so we can ignore it:
1010-
"setservent" | "endservent" if is_illumos => true,
1021+
"setservent" | "endservent" => true,
10111022

10121023
// Following illumos#3729, getifaddrs was changed to a
10131024
// 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
@@ -189,10 +189,6 @@ ISTRIP
189189
IXANY
190190
IXOFF
191191
IXON
192-
LOCK_EX
193-
LOCK_NB
194-
LOCK_SH
195-
LOCK_UN
196192
LOG_ALERT
197193
LOG_AUTH
198194
LOG_CONS

src/unix/mod.rs

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

626626
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
627627
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
628-
#[cfg_attr(
629-
any(target_os = "illumos", target_os = "solaris"),
630-
link_name = "__xnet_socket"
631-
)]
628+
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
629+
#[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
632630
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
633631
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
634632
#[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
@@ -914,6 +912,7 @@ extern "C" {
914912
pub fn getppid() -> pid_t;
915913
pub fn getuid() -> uid_t;
916914
pub fn isatty(fd: ::c_int) -> ::c_int;
915+
#[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
917916
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
918917
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
919918
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
@@ -952,7 +951,10 @@ extern "C" {
952951
all(target_os = "macos", target_arch = "x86"),
953952
link_name = "ttyname_r$UNIX2003"
954953
)]
955-
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
954+
#[cfg_attr(
955+
any(target_os = "illumos", target_os = "solaris"),
956+
link_name = "__posix_ttyname_r"
957+
)]
956958
pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
957959
pub fn unlink(c: *const c_char) -> ::c_int;
958960
#[cfg_attr(
@@ -1073,8 +1075,6 @@ extern "C" {
10731075
)]
10741076
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
10751077

1076-
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1077-
10781078
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
10791079
pub fn times(buf: *mut ::tms) -> ::clock_t;
10801080

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

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

13801381
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1445,10 +1446,15 @@ cfg_if! {
14451446
if #[cfg(not(any(target_os = "emscripten",
14461447
target_os = "android",
14471448
target_os = "haiku",
1448-
target_os = "nto")))] {
1449+
target_os = "nto",
1450+
target_os = "solaris")))] {
14491451
extern "C" {
14501452
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
14511453
}
1454+
} else if #[cfg(target_os = "solaris")] {
1455+
extern "C" {
1456+
pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int;
1457+
}
14521458
}
14531459
}
14541460

@@ -1470,6 +1476,14 @@ cfg_if! {
14701476
}
14711477
}
14721478

1479+
cfg_if! {
1480+
if #[cfg(not(target_os = "solaris"))] {
1481+
extern "C" {
1482+
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1483+
}
1484+
}
1485+
}
1486+
14731487
cfg_if! {
14741488
if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
14751489
extern "C" {

0 commit comments

Comments
 (0)