llvm-project
0cef8288 - [libc] Add TCP_INFO and struct tcp_info to <netinet/tcp.h> (#243858)

Commit
2 days ago
[libc] Add TCP_INFO and struct tcp_info to <netinet/tcp.h> (#243858) This patch adds the TCP_INFO socket option, the Linux definition of struct tcp_info and the TCP_ESTABLISHED..TCP_CLOSING constants which describe the values of its tcpi_state field. The struct definition is based on the kernel's uapi/linux/tcp.h as of Linux 7.3.5. The kernel only ever appends fields to the end of this struct, and the getsockopt call reports how much of it was filled in, so it's safe to use with older or newer kernels as well. I've also added a layout test for the struct and a test which reads the state of a freshly created TCP socket. Assisted-by: Claude
Author
Parents
Loading