[libc-commits] [libc] [libc] Add the implementation of the fdopen function (PR #94186)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Fri Jun 7 11:10:15 PDT 2024
================
@@ -0,0 +1,79 @@
+//===-- Implementation of fdopen --------------------------------*- C++ -*-===//
+//
+// 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/stdio/fdopen.h"
+
+#include "hdr/errno_macros.h"
+#include "include/llvm-libc-macros/fcntl-macros.h"
+#include "src/__support/File/linux/file.h"
+#include "src/__support/OSUtil/fcntl.h"
+#include "src/errno/libc_errno.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(::FILE *, fdopen, (int fd, const char *mode)) {
+ using ModeFlags = File::ModeFlags;
----------------
michaelrj-google wrote:
this implementation looks good, but I think it should be put in `__support/File/linux/file.cpp` next to `openfile` so that future changes will be made to both of them.
https://github.com/llvm/llvm-project/pull/94186
More information about the libc-commits
mailing list