[libc-commits] [libc] [libc] Define TCP_CM_INQ (PR #239982)
Mike Lothian via libc-commits
libc-commits at lists.llvm.org
Sat Nov 7 06:45:17 PST 2026
https://github.com/FireBurn created https://github.com/llvm/llvm-project/pull/239982
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
>From 26d7645fd66b2c5e202f274ccb830d4a6787a584 Mon Sep 17 00:00:00 2001
From: Mike Lothian <mike at fireburn.co.uk>
Date: Mon, 2 Nov 2026 10:22:36 +0000
Subject: [PATCH] [libc] Define TCP_CM_INQ
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
---
.../linux/netinet-tcp-macros.h | 1 +
libc/test/include/CMakeLists.txt | 10 +++++++++
libc/test/include/netinet_tcp_test.cpp | 21 +++++++++++++++++++
3 files changed, 32 insertions(+)
create mode 100644 libc/test/include/netinet_tcp_test.cpp
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);
+}
More information about the libc-commits
mailing list