Skip to content

Commit c8e8ec6

Browse files
committed
Use FreeBSD SO_ constants on newlib
This is necessary to set socket options on the Nintendo Switch, which uses a socket implementation directly ported from FreeBSD.
1 parent 39ca01c commit c8e8ec6

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

src/unix/newlib/mod.rs

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,15 +457,41 @@ pub const SHUT_RD: ::c_int = 0;
457457
pub const SHUT_WR: ::c_int = 1;
458458
pub const SHUT_RDWR: ::c_int = 2;
459459

460-
pub const SO_REUSEADDR: ::c_int = 4;
461-
pub const SO_LINGER: ::c_int = 128;
462-
pub const SO_OOBINLINE: ::c_int = 256;
463-
pub const SO_SNDBUF: ::c_int = 4097;
464-
pub const SO_RCVBUF: ::c_int = 4098;
465-
pub const SO_SNDLOWAT: ::c_int = 4099;
466-
pub const SO_RCVLOWAT: ::c_int = 4100;
467-
pub const SO_TYPE: ::c_int = 4104;
468-
pub const SO_ERROR: ::c_int = 4105;
460+
pub const SO_BINTIME: ::c_int = 0x2000;
461+
pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
462+
pub const SO_NO_DDP: ::c_int = 0x8000;
463+
pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
464+
pub const SO_LABEL: ::c_int = 0x1009;
465+
pub const SO_PEERLABEL: ::c_int = 0x1010;
466+
pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
467+
pub const SO_LISTENQLEN: ::c_int = 0x1012;
468+
pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
469+
pub const SO_SETFIB: ::c_int = 0x1014;
470+
pub const SO_USER_COOKIE: ::c_int = 0x1015;
471+
pub const SO_PROTOCOL: ::c_int = 0x1016;
472+
pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
473+
pub const SO_VENDOR: ::c_int = 0x80000000;
474+
pub const SO_DEBUG: ::c_int = 0x01;
475+
pub const SO_ACCEPTCONN: ::c_int = 0x0002;
476+
pub const SO_REUSEADDR: ::c_int = 0x0004;
477+
pub const SO_KEEPALIVE: ::c_int = 0x0008;
478+
pub const SO_DONTROUTE: ::c_int = 0x0010;
479+
pub const SO_BROADCAST: ::c_int = 0x0020;
480+
pub const SO_USELOOPBACK: ::c_int = 0x0040;
481+
pub const SO_LINGER: ::c_int = 0x0080;
482+
pub const SO_OOBINLINE: ::c_int = 0x0100;
483+
pub const SO_REUSEPORT: ::c_int = 0x0200;
484+
pub const SO_TIMESTAMP: ::c_int = 0x0400;
485+
pub const SO_NOSIGPIPE: ::c_int = 0x0800;
486+
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
487+
pub const SO_SNDBUF: ::c_int = 0x1001;
488+
pub const SO_RCVBUF: ::c_int = 0x1002;
489+
pub const SO_SNDLOWAT: ::c_int = 0x1003;
490+
pub const SO_RCVLOWAT: ::c_int = 0x1004;
491+
pub const SO_SNDTIMEO: ::c_int = 0x1005;
492+
pub const SO_RCVTIMEO: ::c_int = 0x1006;
493+
pub const SO_ERROR: ::c_int = 0x1007;
494+
pub const SO_TYPE: ::c_int = 0x1008;
469495

470496
pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
471497

0 commit comments

Comments
 (0)