TEST(sys_epoll, epoll_pwait_no_sigset) { int epoll_fd = epoll_create(1);
ASSERT_NE(-1, epoll_fd);
// epoll_pwait without a sigset (which is equivalent to epoll_wait).
epoll_event events[1] = {};
ASSERT_EQ(0, epoll_pwait(epoll_fd, events, 1, 1, nullptr));
}
TEST(sys_epoll, epoll_pwait64_no_sigset) { #ifdefined(__BIONIC__) int epoll_fd = epoll_create(1);
ASSERT_NE(-1, epoll_fd);
// epoll_pwait64 without a sigset (which is equivalent to epoll_wait).
epoll_event events[1] = {};
ASSERT_EQ(0, epoll_pwait64(epoll_fd, events, 1, 1, nullptr)); #else
GTEST_SKIP() << "epoll_pwait64 is bionic-only"; #endif
}
TEST(sys_epoll, epoll_pwait2_no_sigset) { #ifdefined(__BIONIC__) int epoll_fd = epoll_create(1);
ASSERT_NE(-1, epoll_fd);
// epoll_pwait2 without a sigset (which is equivalent to epoll_wait).
epoll_event events[1] = {};
timespec ts = {.tv_nsec = 500}; int rc = epoll_pwait2(epoll_fd, events, 1, &ts, nullptr); if (rc == -1 && errno == ENOSYS) GTEST_SKIP() << "no epoll_pwait2() in this kernel";
ASSERT_EQ(0, rc) << strerror(errno); #else
GTEST_SKIP() << "epoll_pwait2 is only in glibc 2.35+"; #endif
}
TEST(sys_epoll, epoll_pwait_with_sigset) { int epoll_fd = epoll_create(1);
ASSERT_NE(-1, epoll_fd);
// Get ready to poll on read end of pipe.
epoll_event ev;
ev.events = EPOLLIN;
ev.data.u64 = expected;
ASSERT_NE(-1, epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fds[0], &ev));
// Ensure there's something in the pipe.
ASSERT_EQ(1, write(fds[1], "\n", 1));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.