[libc-commits] [libc] [libc] Implement getsockopt and setsockopt on linux (PR #192237)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Thu Apr 16 03:02:15 PDT 2026


================
@@ -0,0 +1,70 @@
+//===-- Unittests for getsockopt and setsockopt ---------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "hdr/sys_socket_macros.h"
+#include "src/sys/socket/getsockopt.h"
+#include "src/sys/socket/setsockopt.h"
+#include "src/sys/socket/socket.h"
+
+#include "src/unistd/close.h"
+
+#include "test/UnitTest/ErrnoCheckingTest.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/Test.h"
+#include <sys/socket.h>
+
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
+using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+using LlvmLibcSocketOptTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
+
+TEST_F(LlvmLibcSocketOptTest, BasicSocketOpt) {
----------------
labath wrote:

Done. I used a pipe to not depend on the filesystem.

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


More information about the libc-commits mailing list