authorgravatar for mrjbq7@gmail.comJohn Benediktsson <mrjbq7@gmail.com> 2025-01-22 20:01:05-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-01-23 04:01:05+00:00
log530335b572da5821bd438e2e68febd391502c668
tree88b3bc980fd868c9d66f3236c615b3db74227d28
parent0e815c652d7908be62612bb931c2ee9698dd41da
signaturebadge-check Signed by PGP key B5690EEEBB952194

adding std.c.TCP.NODELAY for macos (#22404)

closes #17260

2 files changed, 34 insertions(+), 0 deletions(-)

lib/std/c.zig+1
...@@ -4952,6 +4952,7 @@ pub const SOCK = switch (native_os) {...@@ -4952,6 +4952,7 @@ pub const SOCK = switch (native_os) {
4952 else => void,4952 else => void,
4953};4953};
4954pub const TCP = switch (native_os) {4954pub const TCP = switch (native_os) {
4955 .macos => darwin.TCP,
4955 .linux => linux.TCP,4956 .linux => linux.TCP,
4956 .emscripten => emscripten.TCP,4957 .emscripten => emscripten.TCP,
4957 .windows => ws2_32.TCP,4958 .windows => ws2_32.TCP,
lib/std/c/darwin.zig+33
...@@ -1517,3 +1517,36 @@ pub const DB_RECORDTYPE = enum(u32) {...@@ -1517,3 +1517,36 @@ pub const DB_RECORDTYPE = enum(u32) {
1517 pub const APP_DEFINED_START = 0x80000000;1517 pub const APP_DEFINED_START = 0x80000000;
1518 pub const APP_DEFINED_END = 0xffffffff;1518 pub const APP_DEFINED_END = 0xffffffff;
1519};1519};
1520
1521pub const TCP = struct {
1522 /// Turn off Nagle's algorithm
1523 pub const NODELAY = 0x01;
1524 /// Limit MSS
1525 pub const MAXSEG = 0x02;
1526 /// Don't push last block of write
1527 pub const NOPUSH = 0x04;
1528 /// Don't use TCP options
1529 pub const NOOPT = 0x08;
1530 /// Idle time used when SO_KEEPALIVE is enabled
1531 pub const KEEPALIVE = 0x10;
1532 /// Connection timeout
1533 pub const CONNECTIONTIMEOUT = 0x20;
1534 /// Time after which a conection in persist timeout will terminate.
1535 pub const PERSIST_TIMEOUT = 0x40;
1536 /// Time after which TCP retransmissions will be stopped and the connection will be dropped.
1537 pub const RXT_CONNDROPTIME = 0x80;
1538 /// Drop a connection after retransmitting the FIN 3 times.
1539 pub const RXT_FINDROP = 0x100;
1540 /// Interval between keepalives
1541 pub const KEEPINTVL = 0x101;
1542 /// Number of keepalives before clsoe
1543 pub const KEEPCNT = 0x102;
1544 /// Always ack every other packet
1545 pub const SENDMOREACKS = 0x103;
1546 /// Enable ECN on a connection
1547 pub const ENABLE_ECN = 0x104;
1548 /// Enable/Disable TCP Fastopen on this socket
1549 pub const FASTOPEN = 0x105;
1550 /// State of the TCP connection
1551 pub const CONNECTION_INFO = 0x106;
1552};