Skip to content

Commit 7ee37b9

Browse files
authored
Merge pull request #4017 from tgross35/backport-watercress
[0.2] Backports
2 parents 8814407 + 61150a4 commit 7ee37b9

File tree

10 files changed

+503
-267
lines changed

10 files changed

+503
-267
lines changed

libc-test/build.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,6 @@ fn test_solarish(target: &str) {
886886
"stdlib.h",
887887
"string.h",
888888
"sys/auxv.h",
889-
"sys/epoll.h",
890-
"sys/eventfd.h",
891889
"sys/file.h",
892890
"sys/filio.h",
893891
"sys/ioctl.h",
@@ -927,6 +925,19 @@ fn test_solarish(target: &str) {
927925
"wchar.h",
928926
}
929927

928+
if is_illumos {
929+
headers! { cfg:
930+
"sys/epoll.h",
931+
"sys/eventfd.h",
932+
}
933+
}
934+
935+
if is_solaris {
936+
headers! { cfg:
937+
"sys/lgrp_user_impl.h",
938+
}
939+
}
940+
930941
cfg.skip_type(move |ty| match ty {
931942
"sighandler_t" => true,
932943
_ => false,
@@ -976,7 +987,7 @@ fn test_solarish(target: &str) {
976987
// EPOLLEXCLUSIVE is a relatively recent addition to the epoll interface and may not be
977988
// defined on older systems. It is, however, safe to use on systems which do not
978989
// explicitly support it. (A no-op is an acceptable implementation of EPOLLEXCLUSIVE.)
979-
"EPOLLEXCLUSIVE" => true,
990+
"EPOLLEXCLUSIVE" if is_illumos => true,
980991

981992
_ => false,
982993
});
@@ -1068,7 +1079,7 @@ fn test_solarish(target: &str) {
10681079
// These functions may return int or void depending on the exact
10691080
// configuration of the compilation environment, but the return
10701081
// value is not useful (always 0) so we can ignore it:
1071-
"setservent" | "endservent" if is_illumos => true,
1082+
"setservent" | "endservent" => true,
10721083

10731084
// Following illumos#3729, getifaddrs was changed to a
10741085
// 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/illumos.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
FD_CLOFORK
2+
F_DUP2FD_CLOEXEC
3+
F_DUP2FD_CLOFORK
4+
F_DUP3FD
5+
F_DUPFD_CLOFORK
6+
MSG_CMSG_CLOEXEC
7+
MSG_CMSG_CLOFORK
8+
O_CLOFORK
19
O_RSYNC
210
POLLRDHUP
311
POSIX_FADV_DONTNEED

libc-test/semver/unix.txt

Lines changed: 0 additions & 4 deletions
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

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,19 @@ pub const ATF_PUBL: ::c_int = 0x08;
314314
pub const ATF_USETRAILERS: ::c_int = 0x10;
315315

316316
pub const FNM_PERIOD: c_int = 1 << 2;
317-
pub const FNM_CASEFOLD: c_int = 1 << 4;
318317
pub const FNM_NOMATCH: c_int = 1;
319318

319+
cfg_if! {
320+
if #[cfg(any(
321+
target_os = "illumos",
322+
target_os = "solaris",
323+
))] {
324+
pub const FNM_CASEFOLD: c_int = 1 << 3;
325+
} else {
326+
pub const FNM_CASEFOLD: c_int = 1 << 4;
327+
}
328+
}
329+
320330
cfg_if! {
321331
if #[cfg(any(
322332
target_os = "macos",
@@ -622,10 +632,8 @@ extern "C" {
622632
target_vendor = "nintendo"
623633
)))]
624634
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
625-
#[cfg_attr(
626-
any(target_os = "illumos", target_os = "solaris"),
627-
link_name = "__xnet_socket"
628-
)]
635+
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
636+
#[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
629637
#[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
630638
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
631639
#[cfg(not(all(
@@ -931,6 +939,7 @@ extern "C" {
931939
pub fn getppid() -> pid_t;
932940
pub fn getuid() -> uid_t;
933941
pub fn isatty(fd: ::c_int) -> ::c_int;
942+
#[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
934943
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
935944
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
936945
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
@@ -968,7 +977,10 @@ extern "C" {
968977
all(target_os = "macos", target_arch = "x86"),
969978
link_name = "ttyname_r$UNIX2003"
970979
)]
971-
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
980+
#[cfg_attr(
981+
any(target_os = "illumos", target_os = "solaris"),
982+
link_name = "__posix_ttyname_r"
983+
)]
972984
pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
973985
pub fn unlink(c: *const c_char) -> ::c_int;
974986
#[cfg_attr(
@@ -1089,8 +1101,6 @@ extern "C" {
10891101
)]
10901102
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
10911103

1092-
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1093-
10941104
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
10951105
pub fn times(buf: *mut ::tms) -> ::clock_t;
10961106

@@ -1399,6 +1409,7 @@ extern "C" {
13991409
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
14001410
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
14011411

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

14041415
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1452,10 +1463,15 @@ cfg_if! {
14521463
if #[cfg(not(any(target_os = "emscripten",
14531464
target_os = "android",
14541465
target_os = "haiku",
1455-
target_os = "nto")))] {
1466+
target_os = "nto",
1467+
target_os = "solaris")))] {
14561468
extern "C" {
14571469
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
14581470
}
1471+
} else if #[cfg(target_os = "solaris")] {
1472+
extern "C" {
1473+
pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> ::c_int;
1474+
}
14591475
}
14601476
}
14611477

@@ -1477,6 +1493,14 @@ cfg_if! {
14771493
}
14781494
}
14791495

1496+
cfg_if! {
1497+
if #[cfg(not(target_os = "solaris"))] {
1498+
extern "C" {
1499+
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1500+
}
1501+
}
1502+
}
1503+
14801504
cfg_if! {
14811505
if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
14821506
extern "C" {

0 commit comments

Comments
 (0)