[libc] [llvm] [libc] add remaining epoll functions, pipe (PR #84587)
Michael Jones via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 13:42:52 PDT 2024
================
@@ -5,16 +5,45 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/linux/sys-epoll-macros.h"
+#include "include/llvm-libc-types/struct_epoll_event.h"
#include "src/errno/libc_errno.h"
+#include "src/sys/epoll/epoll_create1.h"
+#include "src/sys/epoll/epoll_ctl.h"
#include "src/sys/epoll/epoll_pwait.h"
+#include "src/unistd/close.h"
+#include "src/unistd/pipe.h"
#include "test/UnitTest/ErrnoSetterMatcher.h"
#include "test/UnitTest/Test.h"
using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
-TEST(LlvmLibcEpollWaitTest, Basic) {
- EXPECT_THAT(LIBC_NAMESPACE::epoll_pwait(-1, nullptr, 0, 0, nullptr),
- returns(EQ(-1ul)).with_errno(EQ(EINVAL)));
-}
+TEST(LlvmLibcEpollPwaitTest, Basic) {
+ int epfd = LIBC_NAMESPACE::epoll_create1(0);
+ ASSERT_GT(epfd, 0);
+ ASSERT_ERRNO_SUCCESS();
+
+ int pipefd[2];
+
+ ASSERT_THAT(LIBC_NAMESPACE::pipe(pipefd), Succeeds());
+
+ epoll_event event{.events = EPOLLOUT, .data = {.fd = pipefd[0]}};
----------------
michaelrj-google wrote:
for simplicity I moved these to initialize on multiple lines.
https://github.com/llvm/llvm-project/pull/84587
More information about the llvm-commits
mailing list