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

via libc-commits libc-commits at lists.llvm.org
Fri May 29 02:32:01 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Pavel Labath (labath)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/200356.diff


8 Files Affected:

- (modified) libc/config/linux/aarch64/headers.txt (+1) 
- (modified) libc/config/linux/riscv/headers.txt (+1) 
- (modified) libc/config/linux/x86_64/headers.txt (+1) 
- (modified) libc/docs/CMakeLists.txt (+1) 
- (modified) libc/docs/headers/index.rst (+1) 
- (modified) libc/include/CMakeLists.txt (+8) 
- (added) libc/include/netinet/tcp.yaml (+10) 
- (added) libc/utils/docgen/netinet/tcp.yaml (+3) 


``````````diff
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index e321c5425f662..3b54b7e42527f 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -20,6 +20,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 d7ae420240280..b6fd16a319a25 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -20,6 +20,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 1aa63784e8aab..742285d597820 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -20,6 +20,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 f16e0d9056b23..433e91cc1227f 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: ''

``````````

</details>


https://github.com/llvm/llvm-project/pull/200356


More information about the libc-commits mailing list