Update sockopt documentation for clarity

This commit is contained in:
Paul Kulchenko 2022-06-22 21:46:39 -07:00
parent f79b2fe23a
commit 96d030e32b

View file

@ -2659,8 +2659,8 @@ UNIX MODULE
Tunes networking parameters.
`level` and `optname` may be one of the following. The ellipses type
signature above changes depending on which options are used.
`level` and `optname` may be one of the following pairs. The ellipses
type signature above changes depending on which options are used.
unix.getsockopt(fd:int, level:int, optname:int)
├─→ value:int
@ -2669,20 +2669,20 @@ UNIX MODULE
├─→ true
└─→ nil, unix.Errno
- `SOL_SOCKET` + `SO_TYPE`
- `SOL_SOCKET` + `SO_DEBUG`
- `SOL_SOCKET` + `SO_ACCEPTCONN`
- `SOL_SOCKET` + `SO_BROADCAST`
- `SOL_SOCKET` + `SO_REUSEADDR`
- `SOL_SOCKET` + `SO_REUSEPORT`
- `SOL_SOCKET` + `SO_KEEPALIVE`
- `SOL_SOCKET` + `SO_DONTROUTE`
- `SOL_TCP` + `TCP_NODELAY`
- `SOL_TCP` + `TCP_CORK`
- `SOL_TCP` + `TCP_QUICKACK`
- `SOL_TCP` + `TCP_FASTOPEN_CONNECT`
- `SOL_TCP` + `TCP_DEFER_ACCEPT`
- `SOL_IP` + `IP_HDRINCL`
- `SOL_SOCKET`, `SO_TYPE`
- `SOL_SOCKET`, `SO_DEBUG`
- `SOL_SOCKET`, `SO_ACCEPTCONN`
- `SOL_SOCKET`, `SO_BROADCAST`
- `SOL_SOCKET`, `SO_REUSEADDR`
- `SOL_SOCKET`, `SO_REUSEPORT`
- `SOL_SOCKET`, `SO_KEEPALIVE`
- `SOL_SOCKET`, `SO_DONTROUTE`
- `SOL_TCP`, `TCP_NODELAY`
- `SOL_TCP`, `TCP_CORK`
- `SOL_TCP`, `TCP_QUICKACK`
- `SOL_TCP`, `TCP_FASTOPEN_CONNECT`
- `SOL_TCP`, `TCP_DEFER_ACCEPT`
- `SOL_IP`, `IP_HDRINCL`
unix.getsockopt(fd:int, level:int, optname:int)
├─→ value:int
@ -2691,21 +2691,21 @@ UNIX MODULE
├─→ true
└─→ nil, unix.Errno
- `SOL_SOCKET` + `SO_SNDBUF`
- `SOL_SOCKET` + `SO_RCVBUF`
- `SOL_SOCKET` + `SO_RCVLOWAT`
- `SOL_SOCKET` + `SO_SNDLOWAT`
- `SOL_TCP` + `TCP_KEEPIDLE`
- `SOL_TCP` + `TCP_KEEPINTVL`
- `SOL_TCP` + `TCP_FASTOPEN`
- `SOL_TCP` + `TCP_KEEPCNT`
- `SOL_TCP` + `TCP_MAXSEG`
- `SOL_TCP` + `TCP_SYNCNT`
- `SOL_TCP` + `TCP_NOTSENT_LOWAT`
- `SOL_TCP` + `TCP_WINDOW_CLAMP`
- `SOL_IP` + `IP_TOS`
- `SOL_IP` + `IP_MTU`
- `SOL_IP` + `IP_TTL`
- `SOL_SOCKET`, `SO_SNDBUF`
- `SOL_SOCKET`, `SO_RCVBUF`
- `SOL_SOCKET`, `SO_RCVLOWAT`
- `SOL_SOCKET`, `SO_SNDLOWAT`
- `SOL_TCP`, `TCP_KEEPIDLE`
- `SOL_TCP`, `TCP_KEEPINTVL`
- `SOL_TCP`, `TCP_FASTOPEN`
- `SOL_TCP`, `TCP_KEEPCNT`
- `SOL_TCP`, `TCP_MAXSEG`
- `SOL_TCP`, `TCP_SYNCNT`
- `SOL_TCP`, `TCP_NOTSENT_LOWAT`
- `SOL_TCP`, `TCP_WINDOW_CLAMP`
- `SOL_IP`, `IP_TOS`
- `SOL_IP`, `IP_MTU`
- `SOL_IP`, `IP_TTL`
unix.getsockopt(fd:int, level:int, optname:int)
├─→ secs:int, nsecs:int
@ -2714,14 +2714,14 @@ UNIX MODULE
├─→ true
└─→ nil, unix.Errno
- `SOL_SOCKET` + `SO_RCVTIMEO`: If this option is specified then
- `SOL_SOCKET`, `SO_RCVTIMEO`: If this option is specified then
your stream socket will have a read() / recv() timeout. If the
specified interval elapses without receiving data, then EAGAIN
shall be returned by read. If this option is used on listening
sockets, it'll be inherited by accepted sockets. Your redbean
already does this for GetClientFd() based on the `-t` flag.
- `SOL_SOCKET` + `SO_SNDTIMEO`: This is the same as `SO_RCVTIMEO`
- `SOL_SOCKET`, `SO_SNDTIMEO`: This is the same as `SO_RCVTIMEO`
but it applies to the write() / send() functions.
unix.getsockopt(fd:int, unix.SOL_SOCKET, unix.SO_LINGER)