Skip to content

Commit 43f9f53

Browse files
committed
Auto merge of #1964 - jasonbking:tcp, r=JohnTitor
Add more TCP options for solaris systems. This adds the `TCP_KEEPCNT` and `TCP_KEEPINTVL` tcp values to the libc crate. It also corrects the value of `TCP_KEEPIDLE` for Solaris systems. As seen in the diff, the value is different between illumos and Solaris (as the feature was added after the two code bases forked, and each ended up choosing a different value). Adding these to libc will allow the nix crate to utilize them when used on solarish systems.
2 parents 727d0ed + 9cd5c4b commit 43f9f53

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/unix/solarish/illumos.rs

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ pub const EFD_SEMAPHORE: ::c_int = 0x1;
2222
pub const EFD_NONBLOCK: ::c_int = 0x800;
2323
pub const EFD_CLOEXEC: ::c_int = 0x80000;
2424

25+
pub const TCP_KEEPIDLE: ::c_int = 34;
26+
pub const TCP_KEEPCNT: ::c_int = 35;
27+
pub const TCP_KEEPINTVL: ::c_int = 36;
28+
2529
extern "C" {
2630
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
2731

src/unix/solarish/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ pub const IPV6_JOIN_GROUP: ::c_int = 9;
13861386
pub const IPV6_LEAVE_GROUP: ::c_int = 10;
13871387

13881388
pub const TCP_NODELAY: ::c_int = 1;
1389-
pub const TCP_KEEPIDLE: ::c_int = 34;
1389+
13901390
pub const SOL_SOCKET: ::c_int = 0xffff;
13911391
pub const SO_DEBUG: ::c_int = 0x01;
13921392
pub const SO_ACCEPTCONN: ::c_int = 0x0002;

src/unix/solarish/solaris.rs

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ pub const PORT_SOURCE_SIGNAL: ::c_int = 9;
3232
pub const AF_LOCAL: ::c_int = 0;
3333
pub const AF_FILE: ::c_int = 0;
3434

35+
pub const TCP_KEEPIDLE: ::c_int = 0x1d;
36+
pub const TCP_KEEPCNT: ::c_int = 0x1e;
37+
pub const TCP_KEEPINTVL: ::c_int = 0x1f;
38+
3539
extern "C" {
3640
pub fn fexecve(
3741
fd: ::c_int,

0 commit comments

Comments
 (0)