summaryrefslogtreecommitdiff
path: root/src/sys/epoll/linux/epoll_create1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/epoll/linux/epoll_create1.cpp')
-rw-r--r--src/sys/epoll/linux/epoll_create1.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sys/epoll/linux/epoll_create1.cpp b/src/sys/epoll/linux/epoll_create1.cpp
new file mode 100644
index 000000000000..30f1a9910274
--- /dev/null
+++ b/src/sys/epoll/linux/epoll_create1.cpp
@@ -0,0 +1,31 @@
+//===---------- Linux implementation of the epoll_create1 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_create1.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_create1, (int flags)) {
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_epoll_create1, flags);
+
+ // A negative return value indicates an error with the magnitude of the
+ // value being the error code.
+ if (ret < 0) {
+ libc_errno = -ret;
+ return -1;
+ }
+
+ return ret;
+}
+
+} // namespace LIBC_NAMESPACE