[libc-commits] [libc] [libc] Add netinet/tcp.h header (PR #200356)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Fri May 29 02:24:20 PDT 2026
https://github.com/labath created https://github.com/llvm/llvm-project/pull/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.
>From 34e072611a5283d62a027d8d4ec5e2cb9b362d31 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Fri, 29 May 2026 08:46:37 +0000
Subject: [PATCH] [libc] Add netinet/tcp.h header
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.
---
libc/config/linux/aarch64/headers.txt | 1 +
libc/config/linux/riscv/headers.txt | 1 +
libc/config/linux/x86_64/headers.txt | 1 +
libc/docs/CMakeLists.txt | 1 +
libc/docs/headers/index.rst | 1 +
libc/include/CMakeLists.txt | 8 ++++++++
libc/include/netinet/tcp.yaml | 10 ++++++++++
libc/utils/docgen/netinet/tcp.yaml | 3 +++
8 files changed, 26 insertions(+)
create mode 100644 libc/include/netinet/tcp.yaml
create mode 100644 libc/utils/docgen/netinet/tcp.yaml
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: ''
More information about the libc-commits
mailing list