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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Mar 19 09:02:05 PDT 2024


================
@@ -0,0 +1,21 @@
+//===-- Definition of macros from watch-queue.h
+//---------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// References
+// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/watch_queue.h
+// https://kernelnewbies.org/Linux_5.8#Core_.28various.29
+// https://docs.kernel.org/core-api/watch_queue.html
+
+#ifndef LLVM_LIBC_MACROS_LINUX_WATCH_QUEUE_MACROS_H
+#define LLVM_LIBC_MACROS_LINUX_WATCH_QUEUE_MACROS_H
+
+#define O_NOTIFICATION_PIPE                                                    \
+  O_EXCL /* Parameter to pipe2() selecting notification pipe */
----------------
nickdesaulniers wrote:

Ah, this is not something we should be providing; it's ok to `#include <linux/watch_queue.h>` for the definition of `O_NOTIFICATION_PIPE`.

I think that include should go in libc/include/llvm-libc-macros/unistd-macros.h.

libc/include/llvm-libc-macros/unistd-macros.h should then be included in libc/test/src/unistd/pipe2_test.cpp.

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


More information about the libc-commits mailing list