Skip to content

Commit

Permalink
add missing TCP socket options for illumos
Browse files Browse the repository at this point in the history
The socket2 crate now depends on TCP_MAXSEG, and the rest of the options
may as well come along for the ride.
  • Loading branch information
jclulow committed Nov 26, 2020
1 parent 297c002 commit 6b78ca9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/unix/solarish/illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 18 additions & 1 deletion src/unix/solarish/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b78ca9

Please sign in to comment.