[libc] [llvm] [libc] add remaining epoll functions, pipe (PR #84587)

Michael Jones via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 11:05:22 PDT 2024


================
@@ -0,0 +1,39 @@
+//===---------- Linux implementation of the epoll_create function ---------===//
+//
+// 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/sys/epoll/epoll_create.h"
+
+#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/common.h"
+#include "src/errno/libc_errno.h"
+#include <sys/syscall.h> // For syscall numbers.
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(int, epoll_create, (int size)) {
+#ifdef SYS_epoll_create
+  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_epoll_create, size);
+#elif defined(SYS_epoll_create1)
----------------
michaelrj-google wrote:

Generally I prefer to use the requested syscall when possible, and also some platforms do have the newer syscall but not the old one. I ran into issues with that when implementing epoll_wait since a system supported SYS_epoll_pwait but not SYS_epoll_wait.

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


More information about the llvm-commits mailing list