[libc] Add TCP socket options to <netinet/tcp.h> (#236121)
This patch adds SOL_TCP and the TCP level socket option macros
(TCP_MAXSEG, TCP_CORK, TCP_KEEPIDLE, etc.), as well as the constants
used as values for TCP_REPAIR and TCP_REPAIR_QUEUE.
The values are Linux-specific, so I've moved them (along with the
existing TCP_NODELAY definition) out of the yaml file into a new
llvm-libc-macros header with an OS-specific subheader.
I've left out the options which need a struct to be useful (TCP_INFO,
TCP_MD5SIG, TCP_REPAIR_WINDOW, TCP_ZEROCOPY_RECEIVE, TCP_AO_*, etc.).
I'm leaving those for separate patch(es).
glibc and linux define the TCP_*_QUEUE constants as an enum. I've made
them macros instead, since they live in a macro header. This means our
header will not play nicely with <linux/tcp.h>, but that's true of
glibc's header as well.
I've also added a test which sets a couple of options on a TCP socket.
Assisted-by: Gemini