diff options
Diffstat (limited to 'test/syscalls')
-rw-r--r-- | test/syscalls/linux/poll.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/syscalls/linux/poll.cc b/test/syscalls/linux/poll.cc index 7a6a39444..67a86cc22 100644 --- a/test/syscalls/linux/poll.cc +++ b/test/syscalls/linux/poll.cc @@ -255,7 +255,16 @@ TEST_F(PollTest, Nfds) { // Stash value of RLIMIT_NOFILES. struct rlimit rlim; TEST_PCHECK(getrlimit(RLIMIT_NOFILE, &rlim) == 0); + + // gVisor caps the number of FDs that epoll can use beyond RLIMIT_NOFILE. + constexpr rlim_t gVisorMax = 1048576; + if (rlim.rlim_cur > gVisorMax) { + rlim.rlim_cur = gVisorMax; + TEST_PCHECK(setrlimit(RLIMIT_NOFILE, &rlim) == 0); + } + rlim_t max_fds = rlim.rlim_cur; + LOG(INFO) << "Using limit: " << max_fds; // Create an eventfd. Since its value is initially zero, it is writable. FileDescriptor efd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD()); |