commit 7acb0566920a1f74fc21fb8a7411c852b3249374
parent 76a742dd13ad615ff3fd854d54b5849e62bf65be
Author: Conrad Hoffmann <ch@bitfehler.net>
Date: Thu, 10 Aug 2023 22:13:08 +0200
rt: fix off-by-one haredocs for AF_* and IPPROTO_*
Haredoc orders them alphabetically, so the result is just confusing AF.
Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>
Diffstat:
M | rt/+linux/socket.ha | | | 220 | +++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- |
1 file changed, 148 insertions(+), 72 deletions(-)
diff --git a/rt/+linux/socket.ha b/rt/+linux/socket.ha
@@ -77,53 +77,101 @@ export type cmsg = struct {
};
// domain for socket(2)
+
+// Unspecified
export def AF_UNSPEC: u16 = 0;
-export def AF_UNIX: u16 = 1; // Unix domain sockets
-export def AF_LOCAL: u16 = 1; // POSIX name for AF_UNIX
-export def AF_INET: u16 = 2; // Internet IP Protocol
-export def AF_AX25: u16 = 3; // Amateur Radio AX.25
-export def AF_IPX: u16 = 4; // Novell IPX
-export def AF_APPLETALK: u16 = 5; // AppleTalk DDP
-export def AF_NETROM: u16 = 6; // Amateur Radio NET/ROM
-export def AF_BRIDGE: u16 = 7; // Multiprotocol bridge
-export def AF_ATMPVC: u16 = 8; // ATM PVCs
-export def AF_X25: u16 = 9; // Reserved for X.25 project
-export def AF_INET6: u16 = 10; // IP version 6
-export def AF_ROSE: u16 = 11; // Amateur Radio X.25 PLP
-export def AF_DECnet: u16 = 12; // Reserved for DECnet project
-export def AF_NETBEUI: u16 = 13; // Reserved for 802.2LLC project
-export def AF_SECURITY: u16 = 14; // Security callback pseudo AF
-export def AF_KEY: u16 = 15; // PF_KEY key management API
+// Unix domain sockets
+export def AF_UNIX: u16 = 1;
+// POSIX name for AF_UNIX
+export def AF_LOCAL: u16 = 1;
+// Internet IP Protocol
+export def AF_INET: u16 = 2;
+// Amateur Radio AX.25
+export def AF_AX25: u16 = 3;
+// Novell IPX
+export def AF_IPX: u16 = 4;
+// AppleTalk DDP
+export def AF_APPLETALK: u16 = 5;
+// Amateur Radio NET/ROM
+export def AF_NETROM: u16 = 6;
+// Multiprotocol bridge
+export def AF_BRIDGE: u16 = 7;
+// ATM PVCs
+export def AF_ATMPVC: u16 = 8;
+// Reserved for X.25 project
+export def AF_X25: u16 = 9;
+// IP version 6
+export def AF_INET6: u16 = 10;
+// Amateur Radio X.25 PLP
+export def AF_ROSE: u16 = 11;
+// Reserved for DECnet project
+export def AF_DECnet: u16 = 12;
+// Reserved for 802.2LLC project
+export def AF_NETBEUI: u16 = 13;
+// Security callback pseudo AF
+export def AF_SECURITY: u16 = 14;
+// PF_KEY key management API
+export def AF_KEY: u16 = 15;
+// Linux netlink API
export def AF_NETLINK: u16 = 16;
-export def AF_ROUTE: u16 = AF_NETLINK; // Alias to emulate 4.4BSD
-export def AF_PACKET: u16 = 17; // Packet family
-export def AF_ASH: u16 = 18; // Ash
-export def AF_ECONET: u16 = 19; // Acorn Econet
-export def AF_ATMSVC: u16 = 20; // ATM SVCs
-export def AF_RDS: u16 = 21; // RDS sockets
-export def AF_SNA: u16 = 22; // Linux SNA Project (nutters!)
-export def AF_IRDA: u16 = 23; // IRDA sockets
-export def AF_PPPOX: u16 = 24; // PPPoX sockets
-export def AF_WANPIPE: u16 = 25; // Wanpipe API Sockets
-export def AF_LLC: u16 = 26; // Linux LLC
-export def AF_IB: u16 = 27; // Native InfiniBand address
-export def AF_MPLS: u16 = 28; // MPLS
-export def AF_CAN: u16 = 29; // Controller Area Network
-export def AF_TIPC: u16 = 30; // TIPC sockets
-export def AF_BLUETOOTH: u16 = 31; // Bluetooth sockets
-export def AF_IUCV: u16 = 32; // IUCV sockets
-export def AF_RXRPC: u16 = 33; // RxRPC sockets
-export def AF_ISDN: u16 = 34; // mISDN sockets
-export def AF_PHONET: u16 = 35; // Phonet sockets
-export def AF_IEEE802154: u16 = 36; // IEEE802154 sockets
-export def AF_CAIF: u16 = 37; // CAIF sockets
-export def AF_ALG: u16 = 38; // Algorithm sockets
-export def AF_NFC: u16 = 39; // NFC sockets
-export def AF_VSOCK: u16 = 40; // vSockets
-export def AF_KCM: u16 = 41; // Kernel Connection Multiplexor
-export def AF_QIPCRTR: u16 = 42; // Qualcomm IPC Router
-export def AF_SMC: u16 = 43; // smc sockets
-export def AF_XDP: u16 = 44; // XDP sockets
+// Alias to emulate 4.4BSD
+export def AF_ROUTE: u16 = AF_NETLINK;
+// Packet family
+export def AF_PACKET: u16 = 17;
+// Ash
+export def AF_ASH: u16 = 18;
+// Acorn Econet
+export def AF_ECONET: u16 = 19;
+// ATM SVCs
+export def AF_ATMSVC: u16 = 20;
+// RDS sockets
+export def AF_RDS: u16 = 21;
+// Linux SNA Project (nutters!)
+export def AF_SNA: u16 = 22;
+// IRDA sockets
+export def AF_IRDA: u16 = 23;
+// PPPoX sockets
+export def AF_PPPOX: u16 = 24;
+// Wanpipe API Sockets
+export def AF_WANPIPE: u16 = 25;
+// Linux LLC
+export def AF_LLC: u16 = 26;
+// Native InfiniBand address
+export def AF_IB: u16 = 27;
+// MPLS
+export def AF_MPLS: u16 = 28;
+// Controller Area Network
+export def AF_CAN: u16 = 29;
+// TIPC sockets
+export def AF_TIPC: u16 = 30;
+// Bluetooth sockets
+export def AF_BLUETOOTH: u16 = 31;
+// IUCV sockets
+export def AF_IUCV: u16 = 32;
+// RxRPC sockets
+export def AF_RXRPC: u16 = 33;
+// mISDN sockets
+export def AF_ISDN: u16 = 34;
+// Phonet sockets
+export def AF_PHONET: u16 = 35;
+// IEEE802154 sockets
+export def AF_IEEE802154: u16 = 36;
+// CAIF sockets
+export def AF_CAIF: u16 = 37;
+// Algorithm sockets
+export def AF_ALG: u16 = 38;
+// NFC sockets
+export def AF_NFC: u16 = 39;
+// vSockets
+export def AF_VSOCK: u16 = 40;
+// Kernel Connection Multiplexor
+export def AF_KCM: u16 = 41;
+// Qualcomm IPC Router
+export def AF_QIPCRTR: u16 = 42;
+// smc sockets
+export def AF_SMC: u16 = 43;
+// XDP sockets
+export def AF_XDP: u16 = 44;
// type for socket(2)
export def SOCK_STREAM: int = 1;
@@ -137,33 +185,61 @@ export def SOCK_NONBLOCK: int = 0o4000;
export def SOCK_CLOEXEC: int = 0o2000000;
// protocol for socket(2)
-export def IPPROTO_IP: int = 0; // Dummy protocol for TCP
-export def IPPROTO_ICMP: int = 1; // Internet Control Message Protocol
-export def IPPROTO_IGMP: int = 2; // Internet Group Management Protocol
-export def IPPROTO_IPIP: int = 4; // IPIP tunnels (older KA9Q tunnels use 94)
-export def IPPROTO_TCP: int = 6; // Transmission Control Protocol
-export def IPPROTO_EGP: int = 8; // Exterior Gateway Protocol
-export def IPPROTO_PUP: int = 12; // PUP protocol
-export def IPPROTO_UDP: int = 17; // User Datagram Protocol
-export def IPPROTO_IDP: int = 22; // XNS IDP protocol
-export def IPPROTO_TP: int = 29; // SO Transport Protocol Class 4
-export def IPPROTO_DCCP: int = 33; // Datagram Congestion Control Protocol
-export def IPPROTO_IPV6: int = 41; // IPv6-in-IPv4 tunnelling
-export def IPPROTO_RSVP: int = 46; // RSVP Protocol
-export def IPPROTO_GRE: int = 47; // Cisco GRE tunnels (rfc 1701,1702)
-export def IPPROTO_ESP: int = 50; // Encapsulation Security Payload protocol
-export def IPPROTO_AH: int = 51; // Authentication Header protocol
-export def IPPROTO_MTP: int = 92; // Multicast Transport Protocol
-export def IPPROTO_BEETPH: int = 94; // IP option pseudo header for BEET
-export def IPPROTO_ENCAP: int = 98; // Encapsulation Header
-export def IPPROTO_PIM: int = 103; // Protocol Independent Multicast
-export def IPPROTO_COMP: int = 108; // Compression Header Protocol
-export def IPPROTO_SCTP: int = 132; // Stream Control Transport Protocol
-export def IPPROTO_UDPLITE: int = 136; // UDP-Lite (RFC 3828)
-export def IPPROTO_MPLS: int = 137; // MPLS in IP (RFC 4023)
-export def IPPROTO_ETHERNET: int = 143; // Ethernet-within-IPv6 Encapsulation
-export def IPPROTO_RAW: int = 255; // Raw IP packets
-export def IPPROTO_MPTCP: int = 262; // Multipath TCP connection
+
+// Dummy protocol for TCP
+export def IPPROTO_IP: int = 0;
+// Internet Control Message Protocol
+export def IPPROTO_ICMP: int = 1;
+// Internet Group Management Protocol
+export def IPPROTO_IGMP: int = 2;
+// IPIP tunnels (older KA9Q tunnels use 94)
+export def IPPROTO_IPIP: int = 4;
+// Transmission Control Protocol
+export def IPPROTO_TCP: int = 6;
+// Exterior Gateway Protocol
+export def IPPROTO_EGP: int = 8;
+// PUP protocol
+export def IPPROTO_PUP: int = 12;
+// User Datagram Protocol
+export def IPPROTO_UDP: int = 17;
+// XNS IDP protocol
+export def IPPROTO_IDP: int = 22;
+// SO Transport Protocol Class 4
+export def IPPROTO_TP: int = 29;
+// Datagram Congestion Control Protocol
+export def IPPROTO_DCCP: int = 33;
+// IPv6-in-IPv4 tunnelling
+export def IPPROTO_IPV6: int = 41;
+// RSVP Protocol
+export def IPPROTO_RSVP: int = 46;
+// Cisco GRE tunnels (rfc 1701,1702)
+export def IPPROTO_GRE: int = 47;
+// Encapsulation Security Payload protocol
+export def IPPROTO_ESP: int = 50;
+// Authentication Header protocol
+export def IPPROTO_AH: int = 51;
+// Multicast Transport Protocol
+export def IPPROTO_MTP: int = 92;
+// IP option pseudo header for BEET
+export def IPPROTO_BEETPH: int = 94;
+// Encapsulation Header
+export def IPPROTO_ENCAP: int = 98;
+// Protocol Independent Multicast
+export def IPPROTO_PIM: int = 103;
+// Compression Header Protocol
+export def IPPROTO_COMP: int = 108;
+// Stream Control Transport Protocol
+export def IPPROTO_SCTP: int = 132;
+// UDP-Lite (RFC 3828)
+export def IPPROTO_UDPLITE: int = 136;
+// MPLS in IP (RFC 4023)
+export def IPPROTO_MPLS: int = 137;
+// Ethernet-within-IPv6 Encapsulation
+export def IPPROTO_ETHERNET: int = 143;
+// Raw IP packets
+export def IPPROTO_RAW: int = 255;
+// Multipath TCP connection
+export def IPPROTO_MPTCP: int = 262;
// send/rcv flags
export def MSG_OOB: int = 1;