Skip to content

Commit e5b7d9f

Browse files
committed
Auto merge of #1984 - jclulow:illumos-fixups, r=JohnTitor
illumos fixups I needed `TCP_MAXSEG` for use with 0.3.x of [socket2](https://github.com/alexchrichton/socket2-rs), and while I was there I figured I would add the rest of the TCP socket options we have on illumos. Many of these are common with Solaris, but some are not; I have attempted to put them in the correct place so that they will only be active where they are valid. The other commit in this PR gags the test for `setservent()` and `endservent()`, which on illumos have some complexity with respect to return types under different compilation conditions. I don't have an Oracle Solaris system on which to test, but on my relatively current illumos system the tests pass: ``` $ (cd libc-test && CC_x86_64_unknown_illumos=clang AR_x86_64_unknown_illumos=gar cargo test) Compiling libc v0.2.80 (/ws/safari/libc) Compiling libc-test v0.1.0 (/ws/safari/libc/libc-test) Finished test [unoptimized + debuginfo] target(s) in 12.45s Running /ws/safari/libc/target/debug/deps/cmsg-9ceed5ee937b4c5f running 5 tests test t::test_cmsg_data ... ok test t::test_cmsg_firsthdr ... ok test t::test_cmsg_len ... ok test t::test_cmsg_space ... ok test t::test_cmsg_nxthdr ... ok test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running /ws/safari/libc/target/debug/deps/errqueue-70aa763a9ed1f681 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running /ws/safari/libc/target/debug/deps/linux_elf-534b101b72339f59 PASSED 0 tests Running /ws/safari/libc/target/debug/deps/linux_fcntl-4dca948e65c4e2bb PASSED 0 tests Running /ws/safari/libc/target/debug/deps/linux_ipv6-74ce6ee23c41bad1 PASSED 0 tests Running /ws/safari/libc/target/debug/deps/linux_strerror_r-c7705986f4a1d214 PASSED 0 tests Running /ws/safari/libc/target/debug/deps/linux_termios-690bf406ed77f8a9 PASSED 0 tests Running /ws/safari/libc/target/debug/deps/main-0b8735d9db2c09ba RUNNING ALL TESTS PASSED 6543 tests ```
2 parents e67af59 + 6b78ca9 commit e5b7d9f

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

libc-test/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,11 @@ fn test_solarish(target: &str) {
866866
"madvise" | "mprotect" if is_illumos => true,
867867
"door_call" | "door_return" | "door_create" if is_illumos => true,
868868

869+
// These functions may return int or void depending on the exact
870+
// configuration of the compilation environment, but the return
871+
// value is not useful (always 0) so we can ignore it:
872+
"setservent" | "endservent" if is_illumos => true,
873+
869874
_ => false,
870875
}
871876
});

src/unix/solarish/illumos.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000;
2525
pub const TCP_KEEPIDLE: ::c_int = 34;
2626
pub const TCP_KEEPCNT: ::c_int = 35;
2727
pub const TCP_KEEPINTVL: ::c_int = 36;
28+
pub const TCP_CONGESTION: ::c_int = 37;
2829

2930
extern "C" {
3031
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;

src/unix/solarish/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,24 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
13851385
pub const IPV6_JOIN_GROUP: ::c_int = 9;
13861386
pub const IPV6_LEAVE_GROUP: ::c_int = 10;
13871387

1388-
pub const TCP_NODELAY: ::c_int = 1;
1388+
// These TCP socket options are common between illumos and Solaris, while higher
1389+
// numbers have generally diverged:
1390+
pub const TCP_NODELAY: ::c_int = 0x1;
1391+
pub const TCP_MAXSEG: ::c_int = 0x2;
1392+
pub const TCP_KEEPALIVE: ::c_int = 0x8;
1393+
pub const TCP_NOTIFY_THRESHOLD: ::c_int = 0x10;
1394+
pub const TCP_ABORT_THRESHOLD: ::c_int = 0x11;
1395+
pub const TCP_CONN_NOTIFY_THRESHOLD: ::c_int = 0x12;
1396+
pub const TCP_CONN_ABORT_THRESHOLD: ::c_int = 0x13;
1397+
pub const TCP_RECVDSTADDR: ::c_int = 0x14;
1398+
pub const TCP_INIT_CWND: ::c_int = 0x15;
1399+
pub const TCP_KEEPALIVE_THRESHOLD: ::c_int = 0x16;
1400+
pub const TCP_KEEPALIVE_ABORT_THRESHOLD: ::c_int = 0x17;
1401+
pub const TCP_CORK: ::c_int = 0x18;
1402+
pub const TCP_RTO_INITIAL: ::c_int = 0x19;
1403+
pub const TCP_RTO_MIN: ::c_int = 0x1a;
1404+
pub const TCP_RTO_MAX: ::c_int = 0x1b;
1405+
pub const TCP_LINGER2: ::c_int = 0x1c;
13891406

13901407
pub const SOL_SOCKET: ::c_int = 0xffff;
13911408
pub const SO_DEBUG: ::c_int = 0x01;

0 commit comments

Comments
 (0)