summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/epoll.cc
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2019-01-29 08:00:33 -0800
committerShentubot <shentubot@google.com>2019-01-29 08:01:48 -0800
commit57c202ead2d937e40c5d10da409504ac474165d1 (patch)
tree1e0d3365e744b554570563c0f4c661377f475187 /test/syscalls/linux/epoll.cc
parent24cb2c0a7256cdb515c2fc2cfc90d130e2a405ef (diff)
Refactor out NewEventFD to a test utility.
PiperOrigin-RevId: 231404512 Change-Id: I31efcc23a0c4a48ef6fbba3ca07415d79290f55c
Diffstat (limited to 'test/syscalls/linux/epoll.cc')
-rw-r--r--test/syscalls/linux/epoll.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/test/syscalls/linux/epoll.cc b/test/syscalls/linux/epoll.cc
index 46fba7b2d..7b1d83ad8 100644
--- a/test/syscalls/linux/epoll.cc
+++ b/test/syscalls/linux/epoll.cc
@@ -26,6 +26,7 @@
#include "gtest/gtest.h"
#include "test/util/epoll_util.h"
+#include "test/util/eventfd_util.h"
#include "test/util/file_descriptor.h"
#include "test/util/posix_error.h"
#include "test/util/test_util.h"
@@ -38,16 +39,6 @@ namespace {
constexpr int kFDsPerEpoll = 3;
constexpr uint64_t kMagicConstant = 0x0102030405060708;
-// Returns a new eventfd.
-PosixErrorOr<FileDescriptor> NewEventFD() {
- int fd = eventfd(/* initval = */ 0, /* flags = */ 0);
- MaybeSave();
- if (fd < 0) {
- return PosixError(errno, "eventfd");
- }
- return FileDescriptor(fd);
-}
-
uint64_t ms_elapsed(const struct timespec* begin, const struct timespec* end) {
return (end->tv_sec - begin->tv_sec) * 1000 +
(end->tv_nsec - begin->tv_nsec) / 1000000;