Skip to content

Commit bb7942e

Browse files
committed
Improve socket option story
1 parent b14dddc commit bb7942e

File tree

101 files changed

+199
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+199
-558
lines changed

libc/fmt/magnumstrs.internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extern const struct MagnumStr kErrnoDocs[];
2121
extern const struct MagnumStr kErrnoNames[];
2222
extern const struct MagnumStr kFcntlCmds[];
2323
extern const struct MagnumStr kIpOptnames[];
24+
extern const struct MagnumStr kIpv6Optnames[];
2425
extern const struct MagnumStr kOpenFlags[];
2526
extern const struct MagnumStr kRlimitNames[];
2627
extern const struct MagnumStr kSignalNames[];

libc/intrin/BUILD.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ o/$(MODE)/libc/intrin/kerrnodocs.o: libc/intrin/kerrnodocs.S
125125
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
126126
o/$(MODE)/libc/intrin/kipoptnames.o: libc/intrin/kipoptnames.S
127127
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
128+
o/$(MODE)/libc/intrin/kipv6optnames.o: libc/intrin/kipv6optnames.S
129+
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
128130
o/$(MODE)/libc/intrin/kerrnonames.o: libc/intrin/kerrnonames.S
129131
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
130132
o/$(MODE)/libc/intrin/kfcntlcmds.o: libc/intrin/kfcntlcmds.S

libc/intrin/describesockoptname.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ const char *_DescribeSockOptname(char buf[32], int l, int x) {
4949
*p++ = '_';
5050
*p = 0;
5151
ms = kIpOptnames;
52+
} else if (l == SOL_IPV6) {
53+
*p++ = 'I';
54+
*p++ = 'P';
55+
*p++ = 'V';
56+
*p++ = '6';
57+
*p++ = '_';
58+
*p = 0;
59+
ms = kIpv6Optnames;
5260
} else {
5361
ms = 0;
5462
}

libc/intrin/kipoptnames.S

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,18 @@
3232
.underrun
3333
kIpOptnames:
3434
.e IP_TOS,"TOS" // int
35-
.e IP_MTU,"MTU" // int
3635
.e IP_TTL,"TTL" // int
36+
.e IP_MTU,"MTU" // int
3737
.e IP_HDRINCL,"HDRINCL" // bool32
38+
.e IP_OPTIONS,"OPTIONS"
39+
.e IP_RECVTTL,"RECVTTL"
40+
.e IP_ADD_MEMBERSHIP,"ADD_MEMBERSHIP"
41+
.e IP_DROP_MEMBERSHIP,"DROP_MEMBERSHIP"
42+
.e IP_MULTICAST_IF,"MULTICAST_IF"
43+
.e IP_MULTICAST_LOOP,"MULTICAST_LOOP"
44+
.e IP_MULTICAST_TTL,"MULTICAST_TTL"
45+
.e IP_PKTINFO,"PKTINFO"
46+
.e IP_RECVTOS,"RECVTOS"
3847
.long MAGNUM_TERMINATOR
3948
.endobj kIpOptnames,globl,hidden
4049
.overrun

libc/intrin/kipv6optnames.S

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
2+
│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │
3+
╞══════════════════════════════════════════════════════════════════════════════╡
4+
│ Copyright 2021 Justine Alexandra Roberts Tunney │
5+
│ │
6+
│ Permission to use, copy, modify, and/or distribute this software for │
7+
│ any purpose with or without fee is hereby granted, provided that the │
8+
│ above copyright notice and this permission notice appear in all copies. │
9+
│ │
10+
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
11+
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
12+
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
13+
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
14+
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
15+
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
16+
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
17+
│ PERFORMANCE OF THIS SOFTWARE. │
18+
╚─────────────────────────────────────────────────────────────────────────────*/
19+
#include "libc/fmt/magnumstrs.internal.h"
20+
#include "libc/macros.h"
21+
22+
.macro .e e s
23+
.long \e - kIpv6Optnames
24+
.long .L\@ - kIpv6Optnames
25+
.rodata.str1.1
26+
.L\@: .string "\s"
27+
.previous
28+
.endm
29+
30+
.section .rodata
31+
.balign 4
32+
.underrun
33+
kIpv6Optnames:
34+
.e IPV6_V6ONLY,"V6ONLY"
35+
.e IPV6_CHECKSUM,"CHECKSUM"
36+
.e IPV6_JOIN_GROUP,"JOIN_GROUP"
37+
.e IPV6_LEAVE_GROUP,"LEAVE_GROUP"
38+
.e IPV6_MULTICAST_HOPS,"MULTICAST_HOPS"
39+
.e IPV6_MULTICAST_IF,"MULTICAST_IF"
40+
.e IPV6_MULTICAST_LOOP,"MULTICAST_LOOP"
41+
.e IPV6_UNICAST_HOPS,"UNICAST_HOPS"
42+
.e IPV6_RECVTCLASS,"RECVTCLASS"
43+
.e IPV6_TCLASS,"TCLASS"
44+
.e IPV6_DONTFRAG,"DONTFRAG"
45+
.e IPV6_HOPLIMIT,"HOPLIMIT"
46+
.e IPV6_HOPOPTS,"HOPOPTS"
47+
.e IPV6_PKTINFO,"PKTINFO"
48+
.e IPV6_RECVRTHDR,"RECVRTHDR"
49+
.e IPV6_RTHDR,"RTHDR"
50+
.long MAGNUM_TERMINATOR
51+
.endobj kIpv6Optnames,globl,hidden
52+
.overrun

libc/intrin/ksockoptnames.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ kSockOptnames:
4747
.e SO_RCVLOWAT,"RCVLOWAT" // int
4848
.e SO_SNDLOWAT,"SNDLOWAT" // int
4949
.e SO_ERROR,"ERROR" // int
50+
.e SO_OOBINLINE,"OOBINLINE" // int
5051
.long MAGNUM_TERMINATOR
5152
.endobj kSockOptnames,globl,hidden
5253
.overrun

0 commit comments

Comments
 (0)