summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/eventfd.cc
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-05-04 16:00:22 -0700
committergVisor bot <gvisor-bot@google.com>2020-05-04 16:02:07 -0700
commitda71dc7fddda387232b243c6176de21a1208ad0c (patch)
tree20250548a8a2463ce70d9bdd8b1db4f0c7037691 /test/syscalls/linux/eventfd.cc
parente7ed68d22514fffd9d9e2edd4bf11489ae7b0ac8 (diff)
Port eventfd to VFS2.
And move sys_timerfd.go to just timerfd.go for consistency. Updates #1475. PiperOrigin-RevId: 309835029
Diffstat (limited to 'test/syscalls/linux/eventfd.cc')
-rw-r--r--test/syscalls/linux/eventfd.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/syscalls/linux/eventfd.cc b/test/syscalls/linux/eventfd.cc
index 927001eee..548b05a64 100644
--- a/test/syscalls/linux/eventfd.cc
+++ b/test/syscalls/linux/eventfd.cc
@@ -100,6 +100,22 @@ TEST(EventfdTest, SmallRead) {
ASSERT_THAT(read(efd.get(), &l, 4), SyscallFailsWithErrno(EINVAL));
}
+TEST(EventfdTest, PreadIllegalSeek) {
+ FileDescriptor efd =
+ ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, EFD_NONBLOCK | EFD_SEMAPHORE));
+
+ uint64_t l = 0;
+ ASSERT_THAT(pread(efd.get(), &l, 4, 0), SyscallFailsWithErrno(ESPIPE));
+}
+
+TEST(EventfdTest, PwriteIllegalSeek) {
+ FileDescriptor efd =
+ ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, EFD_NONBLOCK | EFD_SEMAPHORE));
+
+ uint64_t l = 0;
+ ASSERT_THAT(pwrite(efd.get(), &l, 4, 0), SyscallFailsWithErrno(ESPIPE));
+}
+
TEST(EventfdTest, BigWrite) {
FileDescriptor efd =
ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, EFD_NONBLOCK | EFD_SEMAPHORE));