[libc-commits] [libc] [libc] pipe(2) linux syscall wrapper and unittest (PR #85514)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 03:57:50 PDT 2024


================
@@ -0,0 +1,63 @@
+//===-- Unittests for pipe2
+//-------------------------------------------------===//
+//
+// 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/errno/libc_errno.h"
+#include "src/unistd/close.h"
+#include "src/unistd/pipe2.h"
+#include "src/unistd/read.h"
+#include "src/unistd/write.h"
+#include "test/UnitTest/ErrnoSetterMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <fcntl.h>
+
+TEST(LlvmLibcPipe2Test, ReadAndWriteViaPipe2) {
+  int pipefd[2];
+  int flags;
+
+  LIBC_NAMESPACE::libc_errno = 0;
+  using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
+
+  // Create pipe(2) with flags set to 0
+  flags = 0;
----------------
muffpy wrote:

Done. And created a new uapi header for O_NOTIFICATION_PIPE. May I ask if we are currently not categorizing headers into things like asm-generic and uapi?

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


More information about the libc-commits mailing list