From 297c00203ab8bf79f13c635a8c37689d0976fc3d Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Wed, 25 Nov 2020 16:34:51 -0800 Subject: [PATCH 1/2] tests should ignore setservent() and endservent() on illumos Depending on the compilation environment (e.g., whether the 3XNET or 3SOCKET version of these functions is in play, whether EXTENSIONS has been defined, etc) these functions may be declared to return either void or int. The return value is hard coded as zero, and can be ignored to better align with other platforms where these functions are always void. --- libc-test/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 8186f9196caf2..04b05000ef119 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -866,6 +866,11 @@ fn test_solarish(target: &str) { "madvise" | "mprotect" if is_illumos => true, "door_call" | "door_return" | "door_create" if is_illumos => true, + // 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, + _ => false, } }); From 6b78ca9e7283b4269bd1f4cb08cfa6610adbcdce Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Wed, 25 Nov 2020 16:34:58 -0800 Subject: [PATCH 2/2] add missing TCP socket options for illumos The socket2 crate now depends on TCP_MAXSEG, and the rest of the options may as well come along for the ride. --- src/unix/solarish/illumos.rs | 1 + src/unix/solarish/mod.rs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 433aa4d3a6277..49aeb9c9d531c 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -25,6 +25,7 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000; pub const TCP_KEEPIDLE: ::c_int = 34; pub const TCP_KEEPCNT: ::c_int = 35; pub const TCP_KEEPINTVL: ::c_int = 36; +pub const TCP_CONGESTION: ::c_int = 37; extern "C" { pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 695c7ebf04b74..0f53fe92dc9f5 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1385,7 +1385,24 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 20; pub const IPV6_JOIN_GROUP: ::c_int = 9; pub const IPV6_LEAVE_GROUP: ::c_int = 10; -pub const TCP_NODELAY: ::c_int = 1; +// These TCP socket options are common between illumos and Solaris, while higher +// numbers have generally diverged: +pub const TCP_NODELAY: ::c_int = 0x1; +pub const TCP_MAXSEG: ::c_int = 0x2; +pub const TCP_KEEPALIVE: ::c_int = 0x8; +pub const TCP_NOTIFY_THRESHOLD: ::c_int = 0x10; +pub const TCP_ABORT_THRESHOLD: ::c_int = 0x11; +pub const TCP_CONN_NOTIFY_THRESHOLD: ::c_int = 0x12; +pub const TCP_CONN_ABORT_THRESHOLD: ::c_int = 0x13; +pub const TCP_RECVDSTADDR: ::c_int = 0x14; +pub const TCP_INIT_CWND: ::c_int = 0x15; +pub const TCP_KEEPALIVE_THRESHOLD: ::c_int = 0x16; +pub const TCP_KEEPALIVE_ABORT_THRESHOLD: ::c_int = 0x17; +pub const TCP_CORK: ::c_int = 0x18; +pub const TCP_RTO_INITIAL: ::c_int = 0x19; +pub const TCP_RTO_MIN: ::c_int = 0x1a; +pub const TCP_RTO_MAX: ::c_int = 0x1b; +pub const TCP_LINGER2: ::c_int = 0x1c; pub const SOL_SOCKET: ::c_int = 0xffff; pub const SO_DEBUG: ::c_int = 0x01;