[libc-commits] [libc] [libc] Implement posix_close in unistd (PR #240024)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Sun Nov 8 19:23:53 PST 2026


================
@@ -0,0 +1,38 @@
+//===-- Linux implementation of posix_close -------------------------------===//
+//
+// 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 "src/unistd/posix_close.h"
+
+#include "hdr/unistd_macros.h"
+#include "src/__support/OSUtil/linux/syscall_wrappers/close.h"
+#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, posix_close, (int fd, int flag)) {
+#ifdef POSIX_CLOSE_RESTART
----------------
vonosmas wrote:

And again and `#if` condition. Why do we need this, if you ensure to always provide a value in a proxy header?

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


More information about the libc-commits mailing list