summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2019-04-08 16:31:06 -0700
committerShentubot <shentubot@google.com>2019-04-08 16:32:11 -0700
commit9471c013483b0709479c51d470ac840621ae7d46 (patch)
tree651bfe7529c28e69320dbe1c9540250e103ba5db /test/syscalls/linux
parent218a7b54494b263001ed791ca13857c12d37ded6 (diff)
Export kernel.SignalInfoPriv.
Also add kernel.SignalInfoNoInfo, and use it in RLIMIT_FSIZE checks. PiperOrigin-RevId: 242562428 Change-Id: I4887c0e1c8f5fddcabfe6d4281bf76d2f2eafe90
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r--test/syscalls/linux/write.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/syscalls/linux/write.cc b/test/syscalls/linux/write.cc
index ca6aafd18..432bd6066 100644
--- a/test/syscalls/linux/write.cc
+++ b/test/syscalls/linux/write.cc
@@ -17,6 +17,7 @@
#include <signal.h>
#include <sys/resource.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <time.h>
#include <unistd.h>
@@ -105,23 +106,33 @@ TEST_F(WriteTest, WriteExceedsRLimit) {
EXPECT_THAT(write(fd, buf.data(), target_lim + 1),
SyscallSucceedsWithValue(target_lim));
EXPECT_THAT(write(fd, buf.data(), 1), SyscallFailsWithErrno(EFBIG));
+ siginfo_t info;
struct timespec timelimit = {0, 0};
- EXPECT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, nullptr, &timelimit),
+ ASSERT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, &info, &timelimit),
SyscallSucceedsWithValue(SIGXFSZ));
+ EXPECT_EQ(info.si_code, SI_USER);
+ EXPECT_EQ(info.si_pid, getpid());
+ EXPECT_EQ(info.si_uid, getuid());
EXPECT_THAT(pwrite(fd, buf.data(), target_lim + 1, 1),
SyscallSucceedsWithValue(target_lim - 1));
EXPECT_THAT(pwrite(fd, buf.data(), 1, target_lim),
SyscallFailsWithErrno(EFBIG));
- EXPECT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, nullptr, &timelimit),
+ ASSERT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, &info, &timelimit),
SyscallSucceedsWithValue(SIGXFSZ));
+ EXPECT_EQ(info.si_code, SI_USER);
+ EXPECT_EQ(info.si_pid, getpid());
+ EXPECT_EQ(info.si_uid, getuid());
EXPECT_THAT(pwrite64(fd, buf.data(), target_lim + 1, 1),
SyscallSucceedsWithValue(target_lim - 1));
EXPECT_THAT(pwrite64(fd, buf.data(), 1, target_lim),
SyscallFailsWithErrno(EFBIG));
- EXPECT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, nullptr, &timelimit),
+ ASSERT_THAT(RetryEINTR(sigtimedwait)(&filesize_mask, &info, &timelimit),
SyscallSucceedsWithValue(SIGXFSZ));
+ EXPECT_EQ(info.si_code, SI_USER);
+ EXPECT_EQ(info.si_pid, getpid());
+ EXPECT_EQ(info.si_uid, getuid());
ASSERT_THAT(sigprocmask(SIG_UNBLOCK, &filesize_mask, nullptr),
SyscallSucceeds());