epoll_ctl: Add test for epoll_ctl04
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 epoll_ctl: Add test for epoll_ctl04
Verify that the maximum number of nesting allowed inside epoll sets is 5, otherwise epoll_ctl fails with EINVAL.
--- runtest/syscalls | 1 + .../kernel/syscalls/epoll_ctl/.gitignore | 1 + .../kernel/syscalls/epoll_ctl/epoll_ctl04.c | 69 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 testcases/kernel/syscalls/epoll_ctl/epoll_ctl04.c
runtest/syscalls +1 -0
@@ -165,6 +165,7 @@ epoll01 epoll-ltp epoll_ctl01 epoll_ctl01 epoll_ctl02 epoll_ctl02 epoll_ctl03 epoll_ctl03 +epoll_ctl04 epoll_ctl04 epoll_wait01 epoll_wait01 epoll_wait02 epoll_wait02 epoll_wait03 epoll_wait03
testcases/kernel/syscalls/epoll_ctl/.gitignore +1 -0
@@ -1,3 +1,4 @@ epoll_ctl01 epoll_ctl02 epoll_ctl03 +epoll_ctl04
testcases/kernel/syscalls/epoll_ctl/epoll_ctl04.c new file +69 -0
69 lines not on this page · raw message
--
2.25.1
PATCH 1/3 epoll_ctl: Add test for epoll_ctl04
Hi!
Patchset pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/3 epoll_ctl: Add test for epoll_ctl05
In reply to a message not in the archiveVerify that epoll_ctl() fails with ELOOP if fd refers to an epoll instance and this EPOLL_CTL_ADD operation would result in a circular loop of epoll instances monitoring one another.
--- runtest/syscalls | 1 + .../kernel/syscalls/epoll_ctl/.gitignore | 1 + .../kernel/syscalls/epoll_ctl/epoll_ctl05.c | 71 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 testcases/kernel/syscalls/epoll_ctl/epoll_ctl05.c
runtest/syscalls +1 -0
@@ -166,6 +166,7 @@ epoll_ctl01 epoll_ctl01 epoll_ctl02 epoll_ctl02 epoll_ctl03 epoll_ctl03 epoll_ctl04 epoll_ctl04 +epoll_ctl05 epoll_ctl05 epoll_wait01 epoll_wait01 epoll_wait02 epoll_wait02 epoll_wait03 epoll_wait03
testcases/kernel/syscalls/epoll_ctl/.gitignore +1 -0
@@ -2,3 +2,4 @@ epoll_ctl01 epoll_ctl02 epoll_ctl03 epoll_ctl04 +epoll_ctl05
testcases/kernel/syscalls/epoll_ctl/epoll_ctl05.c new file +71 -0
71 lines not on this page · raw message
--
2.25.1
PATCH 3/3 epoll_ctl02: Add test for fd not supporting epoll
In reply to a message not in the archiveVerify that epoll_ctl() fails with EPERM if fd does not support epoll. This error can occur if fd refers to, for example, a regular file or a directory.
--- testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c +6 -2
@@ -7,9 +7,10 @@/*\ * [Description] * -* Verify that epoll_cnt() fails with: +* Verify that epoll_ctl() fails with: * * - EBADF if epfd is an invalid fd. +* - EPERM if fd does not support epoll. * - EBADF if fd is an invalid fd. * - EINVAL if op is not supported. * - EINVAL if fd is the same as epfd.
@@ -25,7 +26,7 @@#include "tst_test.h" static int epfd; -static int fd[2 ]; +static int fd[2 ], unsupported_fd;static int inv =-1 ;static struct epoll_event events[2 ] = {
@@ -42,6 +43,7 @@ static struct testcase {const char *desc; } tc[] = { {&inv, EPOLL_CTL_ADD, &fd[1], &events[1], EBADF, "epfd is an invalid fd"}, + {&epfd, EPOLL_CTL_ADD, &unsupported_fd, &events[1], EPERM, "fd does not support epoll"}, {&epfd, EPOLL_CTL_ADD, &inv, &events[1], EBADF, "fd is an invalid fd"}, {&epfd, -1, &fd[1], &events[1], EINVAL, "op is not supported"}, {&epfd, EPOLL_CTL_ADD, &epfd, &events[1], EINVAL, "fd is the same as epfd"},
@@ -53,6 +55,8 @@ static struct testcase {static void setup (void ) { + unsupported_fd =SAFE_OPEN ("." ,O_RDONLY |O_DIRECTORY ,0 ); + epfd =epoll_create (2 );if (epfd ==-1 )tst_brk (TBROK |TERRNO ,"fail to create epoll instance" );
--
2.25.1