File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -1418,6 +1418,39 @@ test24(int (*fd_fun)(int fds[3]))
14181418 return 0 ;
14191419}
14201420
1421+ static int
1422+ test_recursive_register ()
1423+ {
1424+ /* TODO: Check that this test works the same under Linux. */
1425+
1426+ int ep = epoll_create1 (EPOLL_CLOEXEC );
1427+ if (ep < 0 ) {
1428+ return -1 ;
1429+ }
1430+
1431+ int ep_inner = epoll_create1 (EPOLL_CLOEXEC );
1432+ if (ep_inner < 0 ) {
1433+ return -1 ;
1434+ }
1435+
1436+ struct epoll_event event ;
1437+ event .events = EPOLLOUT ;
1438+ event .data .fd = ep_inner ;
1439+
1440+ if (epoll_ctl (ep , EPOLL_CTL_ADD , ep_inner , & event ) < 0 ) {
1441+ return -1 ;
1442+ }
1443+
1444+ if (epoll_ctl (ep , EPOLL_CTL_DEL , ep_inner , NULL ) < 0 ) {
1445+ return -1 ;
1446+ }
1447+
1448+ close (ep_inner );
1449+ close (ep );
1450+
1451+ return 0 ;
1452+ }
1453+
14211454int
14221455main ()
14231456{
@@ -1452,6 +1485,7 @@ main()
14521485 // TEST(test22());
14531486 TEST (test23 ());
14541487 TEST (test24 (fd_tcp_socket ));
1488+ TEST (test_recursive_register ());
14551489
14561490 TEST (testxx ());
14571491 return 0 ;
You can’t perform that action at this time.
0 commit comments