[libc-commits] [libc] 261e0f4 - [libc] Add netinet/tcp.h header (#200356)

via libc-commits libc-commits at lists.llvm.org
Mon Jun 1 01:10:57 PDT 2026


Author: Pavel Labath
Date: 2026-06-01T10:10:52+02:00
New Revision: 261e0f4ec53f1e98a6c5c3a958827eb83c4e4dd9

URL: https://github.com/llvm/llvm-project/commit/261e0f4ec53f1e98a6c5c3a958827eb83c4e4dd9
DIFF: https://github.com/llvm/llvm-project/commit/261e0f4ec53f1e98a6c5c3a958827eb83c4e4dd9.diff

LOG: [libc] Add netinet/tcp.h header (#200356)

This patch adds the netinet/tcp.h header definition. For now I'm only
adding TCP_NODELAY to it, as that's the only constant specified by
POSIX.

I also include the header in the public headers list for linux targets
and hook it up to the implementation status docs.

I don't add a test as this is just a constant definition, and it would
be very hard to devise (if even possible over a loopback interface) a
test to check that the option has the desired effect (in fact, POSIX
says that an implementation doesn't even have to let you set the
option).

Assisted by Gemini.

Added: 
    libc/include/netinet/tcp.yaml
    libc/utils/docgen/netinet/tcp.yaml

Modified: 
    libc/config/linux/aarch64/headers.txt
    libc/config/linux/riscv/headers.txt
    libc/config/linux/x86_64/headers.txt
    libc/docs/CMakeLists.txt
    libc/docs/headers/index.rst
    libc/include/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 60ee8ec28b5fa..ea7327dfb84da 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -21,6 +21,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.malloc
     libc.include.math
     libc.include.netinet_in
+    libc.include.netinet_tcp
     libc.include.poll
     libc.include.pthread
     libc.include.sched

diff  --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index 4f3181278d2db..5f0e2c85b335b 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -21,6 +21,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.malloc
     libc.include.math
     libc.include.netinet_in
+    libc.include.netinet_tcp
     libc.include.poll
     libc.include.pthread
     libc.include.sched

diff  --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 44a8acecdf30f..344550efd6e6c 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -21,6 +21,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.malloc
     libc.include.math
     libc.include.netinet_in
+    libc.include.netinet_tcp
     libc.include.nl_types
     libc.include.poll
     libc.include.pthread

diff  --git a/libc/docs/CMakeLists.txt b/libc/docs/CMakeLists.txt
index 800894c1d5f75..cf54edeae66de 100644
--- a/libc/docs/CMakeLists.txt
+++ b/libc/docs/CMakeLists.txt
@@ -58,6 +58,7 @@ if (SPHINX_FOUND)
       nl_types
       net/if
       netinet/in
+      netinet/tcp
       poll
       pthread
       pwd

diff  --git a/libc/docs/headers/index.rst b/libc/docs/headers/index.rst
index a10f2b6d91744..e818e1549c0d1 100644
--- a/libc/docs/headers/index.rst
+++ b/libc/docs/headers/index.rst
@@ -24,6 +24,7 @@ Implementation Status
    math/index.rst
    net/if
    netinet/in
+   netinet/tcp
    nl_types
    poll
    pwd

diff  --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 35fc83b0148e1..0fbe37efbbf8e 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -225,6 +225,14 @@ add_header_macro(
     .llvm_libc_common_h
 )
 
+add_header_macro(
+  netinet_tcp
+  ../libc/include/netinet/tcp.yaml
+  netinet/tcp.h
+  DEPENDS
+    .llvm_libc_common_h
+)
+
 add_header_macro(
   assert
   ../libc/include/assert.yaml

diff  --git a/libc/include/netinet/tcp.yaml b/libc/include/netinet/tcp.yaml
new file mode 100644
index 0000000000000..9f0e29639ecd4
--- /dev/null
+++ b/libc/include/netinet/tcp.yaml
@@ -0,0 +1,10 @@
+header: netinet/tcp.h
+standards:
+  - posix
+macros:
+  - macro_name: TCP_NODELAY
+    macro_value: 1
+types: []
+enums: []
+objects: []
+functions: []

diff  --git a/libc/utils/docgen/netinet/tcp.yaml b/libc/utils/docgen/netinet/tcp.yaml
new file mode 100644
index 0000000000000..de97a838ade7b
--- /dev/null
+++ b/libc/utils/docgen/netinet/tcp.yaml
@@ -0,0 +1,3 @@
+macros:
+  TCP_NODELAY:
+    in-latest-posix: ''


        


More information about the libc-commits mailing list