Skip to content

Commit a848ce4

Browse files
drewcrawfordvhbit
authored andcommitted
Adding sys/socket.h constants for iOS/Mac, particularly for SO_SOCKET options.
This is probably more broadly applicable than these two platforms (since it's part of the bsd4.4 standard) but that's outside my problem domain today. If this goes well, I may submit Linux/64 support in a separate PR. Reviewers should take a look at http://www.opensource.apple.com/source/xnu/xnu-792.17.14/bsd/sys/socket.h?txt which defines constants for OSX. iOS uses the same header. I release this patch under the MIT license.
1 parent d5408f3 commit a848ce4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/liblibc/lib.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4820,10 +4820,25 @@ pub mod consts {
48204820
pub const TCP_NODELAY: c_int = 0x01;
48214821
pub const TCP_KEEPALIVE: c_int = 0x10;
48224822
pub const SOL_SOCKET: c_int = 0xffff;
4823+
4824+
pub const SO_DEBUG: c_int = 0x01;
4825+
pub const SO_ACCEPTCONN: c_int = 0x0002;
4826+
pub const SO_REUSEADDR: c_int = 0x0004;
48234827
pub const SO_KEEPALIVE: c_int = 0x0008;
4828+
pub const SO_DONTROUTE: c_int = 0x0010;
48244829
pub const SO_BROADCAST: c_int = 0x0020;
4825-
pub const SO_REUSEADDR: c_int = 0x0004;
4830+
pub const SO_USELOOPBACK: c_int = 0x0040;
4831+
pub const SO_LINGER: c_int = 0x0080;
4832+
pub const SO_OOBINLINE: c_int = 0x0100;
4833+
pub const SO_REUSEPORT: c_int = 0x0200;
4834+
pub const SO_SNDBUF: c_int = 0x1001;
4835+
pub const SO_RCVBUF: c_int = 0x1002;
4836+
pub const SO_SNDLOWAT: c_int = 0x1003;
4837+
pub const SO_RCVLOWAT: c_int = 0x1004;
4838+
pub const SO_SNDTIMEO: c_int = 0x1005;
4839+
pub const SO_RCVTIMEO: c_int = 0x1006;
48264840
pub const SO_ERROR: c_int = 0x1007;
4841+
pub const SO_TYPE: c_int = 0x1008;
48274842

48284843
pub const IFF_LOOPBACK: c_int = 0x8;
48294844

0 commit comments

Comments
 (0)