[libc-commits] [libc] [libc] Define TCP_CM_INQ (PR #239982)

via libc-commits libc-commits at lists.llvm.org
Sat Nov 7 06:45:56 PST 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Mike Lothian (FireBurn)

<details>
<summary>Changes</summary>

The kernel's headers name the control message type that TCP_INQ asks for
separately. gRPC reads the byte count back by that name and does not
define it when TCP_INQ is already defined, so it did not compile.

Assisted-by: Claude

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


3 Files Affected:

- (modified) libc/include/llvm-libc-macros/linux/netinet-tcp-macros.h (+1) 
- (modified) libc/test/include/CMakeLists.txt (+10) 
- (added) libc/test/include/netinet_tcp_test.cpp (+21) 


``````````diff
diff --git a/libc/include/llvm-libc-macros/linux/netinet-tcp-macros.h b/libc/include/llvm-libc-macros/linux/netinet-tcp-macros.h
index 0dffe507dc9fc1..3da802947f7e8a 100644
--- a/libc/include/llvm-libc-macros/linux/netinet-tcp-macros.h
+++ b/libc/include/llvm-libc-macros/linux/netinet-tcp-macros.h
@@ -46,6 +46,7 @@
 #define TCP_FASTOPEN_KEY 33 // unsigned char[]
 #define TCP_FASTOPEN_NO_COOKIE 34
 #define TCP_INQ 36
+#define TCP_CM_INQ TCP_INQ
 #define TCP_TX_DELAY 37
 #define TCP_IS_MPTCP 43
 #define TCP_RTO_MAX_MS 44
diff --git a/libc/test/include/CMakeLists.txt b/libc/test/include/CMakeLists.txt
index 28fdff096bbcea..e241fbe53ac25b 100644
--- a/libc/test/include/CMakeLists.txt
+++ b/libc/test/include/CMakeLists.txt
@@ -611,3 +611,13 @@ foreach(target ${TARGET_PUBLIC_HEADERS})
     )
   endforeach()
 endforeach()
+
+add_libc_test(
+  netinet_tcp_test
+  SUITE
+    libc-include-tests
+  SRCS
+    netinet_tcp_test.cpp
+  DEPENDS
+    libc.include.llvm-libc-macros.netinet_tcp_macros
+)
diff --git a/libc/test/include/netinet_tcp_test.cpp b/libc/test/include/netinet_tcp_test.cpp
new file mode 100644
index 00000000000000..b507d314b8ac9a
--- /dev/null
+++ b/libc/test/include/netinet_tcp_test.cpp
@@ -0,0 +1,21 @@
+//===-- Unittests for the netinet/tcp.h macros ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Unittests for the netinet/tcp.h macros.
+///
+//===----------------------------------------------------------------------===//
+
+#include "include/llvm-libc-macros/netinet-tcp-macros.h"
+#include "test/UnitTest/Test.h"
+
+// The kernel names the control message type of TCP_INQ separately, and
+// callers read the byte count back by that name.
+TEST(LlvmLibcNetinetTcpTest, InqControlMessageHasTheOptionValue) {
+  EXPECT_EQ(TCP_CM_INQ, TCP_INQ);
+}

``````````

</details>


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


More information about the libc-commits mailing list