Lines Matching +full:1 +full:e

27 #define __NR_epoll_pwait2 -1
52 struct epoll_event e; in waiter_entry1a() local
55 if (epoll_wait(ctx->efd[0], &e, 1, -1) > 0) in waiter_entry1a()
56 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry1a()
64 struct epoll_event e; in waiter_entry1ap() local
69 if (poll(&pfd, 1, -1) > 0) { in waiter_entry1ap()
70 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) in waiter_entry1ap()
71 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry1ap()
79 struct epoll_event e; in waiter_entry1o() local
82 if (epoll_wait(ctx->efd[0], &e, 1, -1) > 0) in waiter_entry1o()
83 __sync_fetch_and_or(&ctx->count, 1); in waiter_entry1o()
91 struct epoll_event e; in waiter_entry1op() local
96 if (poll(&pfd, 1, -1) > 0) { in waiter_entry1op()
97 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) in waiter_entry1op()
98 __sync_fetch_and_or(&ctx->count, 1); in waiter_entry1op()
109 if (epoll_wait(ctx->efd[0], events, 2, -1) > 0) in waiter_entry2a()
110 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry2a()
123 if (poll(&pfd, 1, -1) > 0) { in waiter_entry2ap()
125 __sync_fetch_and_add(&ctx->count, 1); in waiter_entry2ap()
136 write(ctx->sfd[1], "w", 1); in emitter_entry1()
148 write(ctx->sfd[1], "w", 1); in emitter_entry2()
149 write(ctx->sfd[3], "w", 1); in emitter_entry2()
167 struct epoll_event e; in TEST() local
171 efd = epoll_create(1); in TEST()
174 e.events = EPOLLIN; in TEST()
175 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
177 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
179 EXPECT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
180 EXPECT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
184 close(sfd[1]); in TEST()
198 struct epoll_event e; in TEST() local
202 efd = epoll_create(1); in TEST()
205 e.events = EPOLLIN | EPOLLET; in TEST()
206 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
208 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
210 EXPECT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
211 EXPECT_EQ(epoll_wait(efd, &e, 1, 0), 0); in TEST()
215 close(sfd[1]); in TEST()
234 efd = epoll_create(1); in TEST()
243 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
244 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
251 close(sfd[1]); in TEST()
272 efd = epoll_create(1); in TEST()
281 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
282 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
289 close(sfd[1]); in TEST()
306 struct epoll_event e; in TEST() local
310 efd = epoll_create(1); in TEST()
313 e.events = EPOLLIN; in TEST()
314 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
316 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
320 ASSERT_EQ(poll(&pfd, 1, 0), 1); in TEST()
321 ASSERT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
325 ASSERT_EQ(poll(&pfd, 1, 0), 1); in TEST()
326 ASSERT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
330 close(sfd[1]); in TEST()
345 struct epoll_event e; in TEST() local
349 efd = epoll_create(1); in TEST()
352 e.events = EPOLLIN | EPOLLET; in TEST()
353 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
355 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
359 ASSERT_EQ(poll(&pfd, 1, 0), 1); in TEST()
360 ASSERT_EQ(epoll_wait(efd, &e, 1, 0), 1); in TEST()
364 ASSERT_EQ(poll(&pfd, 1, 0), 0); in TEST()
365 ASSERT_EQ(epoll_wait(efd, &e, 1, 0), 0); in TEST()
369 close(sfd[1]); in TEST()
390 efd = epoll_create(1); in TEST()
399 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
400 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
404 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
409 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
414 close(sfd[1]); in TEST()
436 efd = epoll_create(1); in TEST()
445 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
446 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
450 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
455 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
460 close(sfd[1]); in TEST()
475 struct epoll_event e; in TEST() local
482 ctx.efd[0] = epoll_create(1); in TEST()
485 e.events = EPOLLIN; in TEST()
486 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
492 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
493 __sync_fetch_and_add(&ctx.count, 1); in TEST()
505 close(ctx.sfd[1]); in TEST()
518 struct epoll_event e; in TEST() local
525 ctx.efd[0] = epoll_create(1); in TEST()
528 e.events = EPOLLIN | EPOLLET; in TEST()
529 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
535 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
536 __sync_fetch_and_add(&ctx.count, 1); in TEST()
539 EXPECT_EQ(ctx.count, 1); in TEST()
548 close(ctx.sfd[1]); in TEST()
569 ctx.efd[0] = epoll_create(1); in TEST()
582 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
583 __sync_fetch_and_add(&ctx.count, 1); in TEST()
595 close(ctx.sfd[1]); in TEST()
618 ctx.efd[0] = epoll_create(1); in TEST()
631 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
632 __sync_fetch_and_add(&ctx.count, 1); in TEST()
644 close(ctx.sfd[1]); in TEST()
659 struct epoll_event e; in TEST() local
666 ctx.efd[0] = epoll_create(1); in TEST()
669 e.events = EPOLLIN; in TEST()
670 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
676 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
677 __sync_fetch_and_add(&ctx.count, 1); in TEST()
689 close(ctx.sfd[1]); in TEST()
702 struct epoll_event e; in TEST() local
709 ctx.efd[0] = epoll_create(1); in TEST()
712 e.events = EPOLLIN | EPOLLET; in TEST()
713 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
719 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
720 __sync_fetch_and_add(&ctx.count, 1); in TEST()
723 EXPECT_EQ(ctx.count, 1); in TEST()
732 close(ctx.sfd[1]); in TEST()
753 ctx.efd[0] = epoll_create(1); in TEST()
766 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
767 __sync_fetch_and_add(&ctx.count, 1); in TEST()
779 close(ctx.sfd[1]); in TEST()
802 ctx.efd[0] = epoll_create(1); in TEST()
815 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
816 __sync_fetch_and_add(&ctx.count, 1); in TEST()
828 close(ctx.sfd[1]); in TEST()
846 struct epoll_event e; in TEST() local
850 efd[0] = epoll_create(1); in TEST()
853 efd[1] = epoll_create(1); in TEST()
854 ASSERT_GE(efd[1], 0); in TEST()
856 e.events = EPOLLIN; in TEST()
857 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
859 e.events = EPOLLIN; in TEST()
860 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
862 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
864 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
865 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
868 close(efd[1]); in TEST()
870 close(sfd[1]); in TEST()
886 struct epoll_event e; in TEST() local
890 efd[0] = epoll_create(1); in TEST()
893 efd[1] = epoll_create(1); in TEST()
894 ASSERT_GE(efd[1], 0); in TEST()
896 e.events = EPOLLIN | EPOLLET; in TEST()
897 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
899 e.events = EPOLLIN; in TEST()
900 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
902 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
904 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
905 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
908 close(efd[1]); in TEST()
910 close(sfd[1]); in TEST()
926 struct epoll_event e; in TEST() local
930 efd[0] = epoll_create(1); in TEST()
933 efd[1] = epoll_create(1); in TEST()
934 ASSERT_GE(efd[1], 0); in TEST()
936 e.events = EPOLLIN; in TEST()
937 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
939 e.events = EPOLLIN | EPOLLET; in TEST()
940 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
942 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
944 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
945 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 0); in TEST()
948 close(efd[1]); in TEST()
950 close(sfd[1]); in TEST()
966 struct epoll_event e; in TEST() local
970 efd[0] = epoll_create(1); in TEST()
973 efd[1] = epoll_create(1); in TEST()
974 ASSERT_GE(efd[1], 0); in TEST()
976 e.events = EPOLLIN | EPOLLET; in TEST()
977 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
979 e.events = EPOLLIN | EPOLLET; in TEST()
980 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
982 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
984 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
985 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 0); in TEST()
988 close(efd[1]); in TEST()
990 close(sfd[1]); in TEST()
1007 struct epoll_event e; in TEST() local
1011 efd[0] = epoll_create(1); in TEST()
1014 efd[1] = epoll_create(1); in TEST()
1015 ASSERT_GE(efd[1], 0); in TEST()
1017 e.events = EPOLLIN; in TEST()
1018 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
1020 e.events = EPOLLIN; in TEST()
1021 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
1023 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
1027 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1028 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1032 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1033 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1036 close(efd[1]); in TEST()
1038 close(sfd[1]); in TEST()
1055 struct epoll_event e; in TEST() local
1059 efd[0] = epoll_create(1); in TEST()
1062 efd[1] = epoll_create(1); in TEST()
1063 ASSERT_GE(efd[1], 0); in TEST()
1065 e.events = EPOLLIN | EPOLLET; in TEST()
1066 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
1068 e.events = EPOLLIN; in TEST()
1069 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
1071 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
1075 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1076 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1080 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1081 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1084 close(efd[1]); in TEST()
1086 close(sfd[1]); in TEST()
1103 struct epoll_event e; in TEST() local
1107 efd[0] = epoll_create(1); in TEST()
1110 efd[1] = epoll_create(1); in TEST()
1111 ASSERT_GE(efd[1], 0); in TEST()
1113 e.events = EPOLLIN; in TEST()
1114 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
1116 e.events = EPOLLIN | EPOLLET; in TEST()
1117 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
1119 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
1123 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1124 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1128 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
1129 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 0); in TEST()
1132 close(efd[1]); in TEST()
1134 close(sfd[1]); in TEST()
1151 struct epoll_event e; in TEST() local
1155 efd[0] = epoll_create(1); in TEST()
1158 efd[1] = epoll_create(1); in TEST()
1159 ASSERT_GE(efd[1], 0); in TEST()
1161 e.events = EPOLLIN | EPOLLET; in TEST()
1162 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
1164 e.events = EPOLLIN | EPOLLET; in TEST()
1165 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], &e), 0); in TEST()
1167 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
1171 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
1172 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 1); in TEST()
1176 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
1177 EXPECT_EQ(epoll_wait(efd[0], &e, 1, 0), 0); in TEST()
1180 close(efd[1]); in TEST()
1182 close(sfd[1]); in TEST()
1197 struct epoll_event e; in TEST() local
1204 ctx.efd[0] = epoll_create(1); in TEST()
1207 ctx.efd[1] = epoll_create(1); in TEST()
1208 ASSERT_GE(ctx.efd[1], 0); in TEST()
1210 e.events = EPOLLIN; in TEST()
1211 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1213 e.events = EPOLLIN; in TEST()
1214 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1220 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1221 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1232 close(ctx.efd[1]); in TEST()
1234 close(ctx.sfd[1]); in TEST()
1249 struct epoll_event e; in TEST() local
1256 ctx.efd[0] = epoll_create(1); in TEST()
1259 ctx.efd[1] = epoll_create(1); in TEST()
1260 ASSERT_GE(ctx.efd[1], 0); in TEST()
1262 e.events = EPOLLIN | EPOLLET; in TEST()
1263 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1265 e.events = EPOLLIN; in TEST()
1266 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1272 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1273 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1284 close(ctx.efd[1]); in TEST()
1286 close(ctx.sfd[1]); in TEST()
1301 struct epoll_event e; in TEST() local
1308 ctx.efd[0] = epoll_create(1); in TEST()
1311 ctx.efd[1] = epoll_create(1); in TEST()
1312 ASSERT_GE(ctx.efd[1], 0); in TEST()
1314 e.events = EPOLLIN; in TEST()
1315 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1317 e.events = EPOLLIN | EPOLLET; in TEST()
1318 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1324 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1325 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1328 EXPECT_EQ(ctx.count, 1); in TEST()
1336 close(ctx.efd[1]); in TEST()
1338 close(ctx.sfd[1]); in TEST()
1353 struct epoll_event e; in TEST() local
1360 ctx.efd[0] = epoll_create(1); in TEST()
1363 ctx.efd[1] = epoll_create(1); in TEST()
1364 ASSERT_GE(ctx.efd[1], 0); in TEST()
1366 e.events = EPOLLIN | EPOLLET; in TEST()
1367 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1369 e.events = EPOLLIN | EPOLLET; in TEST()
1370 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1376 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1377 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1380 EXPECT_EQ(ctx.count, 1); in TEST()
1388 close(ctx.efd[1]); in TEST()
1390 close(ctx.sfd[1]); in TEST()
1405 struct epoll_event e; in TEST() local
1412 ctx.efd[0] = epoll_create(1); in TEST()
1415 ctx.efd[1] = epoll_create(1); in TEST()
1416 ASSERT_GE(ctx.efd[1], 0); in TEST()
1418 e.events = EPOLLIN; in TEST()
1419 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1421 e.events = EPOLLIN; in TEST()
1422 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1428 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1429 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1441 close(ctx.sfd[1]); in TEST()
1456 struct epoll_event e; in TEST() local
1463 ctx.efd[0] = epoll_create(1); in TEST()
1466 ctx.efd[1] = epoll_create(1); in TEST()
1467 ASSERT_GE(ctx.efd[1], 0); in TEST()
1469 e.events = EPOLLIN | EPOLLET; in TEST()
1470 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1472 e.events = EPOLLIN; in TEST()
1473 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1479 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1480 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1492 close(ctx.sfd[1]); in TEST()
1507 struct epoll_event e; in TEST() local
1514 ctx.efd[0] = epoll_create(1); in TEST()
1517 ctx.efd[1] = epoll_create(1); in TEST()
1518 ASSERT_GE(ctx.efd[1], 0); in TEST()
1520 e.events = EPOLLIN; in TEST()
1521 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1523 e.events = EPOLLIN | EPOLLET; in TEST()
1524 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1530 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1531 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1534 EXPECT_EQ(ctx.count, 1); in TEST()
1543 close(ctx.sfd[1]); in TEST()
1558 struct epoll_event e; in TEST() local
1565 ctx.efd[0] = epoll_create(1); in TEST()
1568 ctx.efd[1] = epoll_create(1); in TEST()
1569 ASSERT_GE(ctx.efd[1], 0); in TEST()
1571 e.events = EPOLLIN | EPOLLET; in TEST()
1572 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1574 e.events = EPOLLIN | EPOLLET; in TEST()
1575 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1581 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1582 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1585 EXPECT_EQ(ctx.count, 1); in TEST()
1594 close(ctx.sfd[1]); in TEST()
1609 struct epoll_event e; in TEST() local
1616 ctx.efd[0] = epoll_create(1); in TEST()
1619 ctx.efd[1] = epoll_create(1); in TEST()
1620 ASSERT_GE(ctx.efd[1], 0); in TEST()
1622 e.events = EPOLLIN; in TEST()
1623 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1625 e.events = EPOLLIN; in TEST()
1626 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1632 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1633 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1644 close(ctx.efd[1]); in TEST()
1646 close(ctx.sfd[1]); in TEST()
1661 struct epoll_event e; in TEST() local
1668 ctx.efd[0] = epoll_create(1); in TEST()
1671 ctx.efd[1] = epoll_create(1); in TEST()
1672 ASSERT_GE(ctx.efd[1], 0); in TEST()
1674 e.events = EPOLLIN | EPOLLET; in TEST()
1675 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1677 e.events = EPOLLIN; in TEST()
1678 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1684 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1696 close(ctx.efd[1]); in TEST()
1698 close(ctx.sfd[1]); in TEST()
1713 struct epoll_event e; in TEST() local
1720 ctx.efd[0] = epoll_create(1); in TEST()
1723 ctx.efd[1] = epoll_create(1); in TEST()
1724 ASSERT_GE(ctx.efd[1], 0); in TEST()
1726 e.events = EPOLLIN; in TEST()
1727 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1729 e.events = EPOLLIN | EPOLLET; in TEST()
1730 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1736 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1737 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1748 close(ctx.efd[1]); in TEST()
1750 close(ctx.sfd[1]); in TEST()
1765 struct epoll_event e; in TEST() local
1772 ctx.efd[0] = epoll_create(1); in TEST()
1775 ctx.efd[1] = epoll_create(1); in TEST()
1776 ASSERT_GE(ctx.efd[1], 0); in TEST()
1778 e.events = EPOLLIN | EPOLLET; in TEST()
1779 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1781 e.events = EPOLLIN | EPOLLET; in TEST()
1782 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1788 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1800 close(ctx.efd[1]); in TEST()
1802 close(ctx.sfd[1]); in TEST()
1818 struct epoll_event e; in TEST() local
1825 ctx.efd[0] = epoll_create(1); in TEST()
1828 ctx.efd[1] = epoll_create(1); in TEST()
1829 ASSERT_GE(ctx.efd[1], 0); in TEST()
1831 e.events = EPOLLIN; in TEST()
1832 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1834 e.events = EPOLLIN; in TEST()
1835 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1841 pfd.fd = ctx.efd[1]; in TEST()
1843 if (poll(&pfd, 1, -1) > 0) { in TEST()
1844 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1845 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1857 close(ctx.efd[1]); in TEST()
1859 close(ctx.sfd[1]); in TEST()
1875 struct epoll_event e; in TEST() local
1882 ctx.efd[0] = epoll_create(1); in TEST()
1885 ctx.efd[1] = epoll_create(1); in TEST()
1886 ASSERT_GE(ctx.efd[1], 0); in TEST()
1888 e.events = EPOLLIN | EPOLLET; in TEST()
1889 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1891 e.events = EPOLLIN; in TEST()
1892 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1898 pfd.fd = ctx.efd[1]; in TEST()
1900 if (poll(&pfd, 1, -1) > 0) { in TEST()
1901 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1914 close(ctx.efd[1]); in TEST()
1916 close(ctx.sfd[1]); in TEST()
1932 struct epoll_event e; in TEST() local
1939 ctx.efd[0] = epoll_create(1); in TEST()
1942 ctx.efd[1] = epoll_create(1); in TEST()
1943 ASSERT_GE(ctx.efd[1], 0); in TEST()
1945 e.events = EPOLLIN; in TEST()
1946 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
1948 e.events = EPOLLIN | EPOLLET; in TEST()
1949 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
1955 pfd.fd = ctx.efd[1]; in TEST()
1957 if (poll(&pfd, 1, -1) > 0) { in TEST()
1958 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1959 __sync_fetch_and_add(&ctx.count, 1); in TEST()
1971 close(ctx.efd[1]); in TEST()
1973 close(ctx.sfd[1]); in TEST()
1989 struct epoll_event e; in TEST() local
1996 ctx.efd[0] = epoll_create(1); in TEST()
1999 ctx.efd[1] = epoll_create(1); in TEST()
2000 ASSERT_GE(ctx.efd[1], 0); in TEST()
2002 e.events = EPOLLIN | EPOLLET; in TEST()
2003 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2005 e.events = EPOLLIN | EPOLLET; in TEST()
2006 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2012 pfd.fd = ctx.efd[1]; in TEST()
2014 if (poll(&pfd, 1, -1) > 0) { in TEST()
2015 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2028 close(ctx.efd[1]); in TEST()
2030 close(ctx.sfd[1]); in TEST()
2045 struct epoll_event e; in TEST() local
2052 ctx.efd[0] = epoll_create(1); in TEST()
2055 ctx.efd[1] = epoll_create(1); in TEST()
2056 ASSERT_GE(ctx.efd[1], 0); in TEST()
2058 e.events = EPOLLIN; in TEST()
2059 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2061 e.events = EPOLLIN; in TEST()
2062 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2068 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2069 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2080 close(ctx.efd[1]); in TEST()
2082 close(ctx.sfd[1]); in TEST()
2097 struct epoll_event e; in TEST() local
2104 ctx.efd[0] = epoll_create(1); in TEST()
2107 ctx.efd[1] = epoll_create(1); in TEST()
2108 ASSERT_GE(ctx.efd[1], 0); in TEST()
2110 e.events = EPOLLIN | EPOLLET; in TEST()
2111 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2113 e.events = EPOLLIN; in TEST()
2114 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2120 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2132 close(ctx.efd[1]); in TEST()
2134 close(ctx.sfd[1]); in TEST()
2149 struct epoll_event e; in TEST() local
2156 ctx.efd[0] = epoll_create(1); in TEST()
2159 ctx.efd[1] = epoll_create(1); in TEST()
2160 ASSERT_GE(ctx.efd[1], 0); in TEST()
2162 e.events = EPOLLIN; in TEST()
2163 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2165 e.events = EPOLLIN | EPOLLET; in TEST()
2166 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2172 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2173 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2184 close(ctx.efd[1]); in TEST()
2186 close(ctx.sfd[1]); in TEST()
2201 struct epoll_event e; in TEST() local
2208 ctx.efd[0] = epoll_create(1); in TEST()
2211 ctx.efd[1] = epoll_create(1); in TEST()
2212 ASSERT_GE(ctx.efd[1], 0); in TEST()
2214 e.events = EPOLLIN | EPOLLET; in TEST()
2215 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2217 e.events = EPOLLIN | EPOLLET; in TEST()
2218 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2224 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2236 close(ctx.efd[1]); in TEST()
2238 close(ctx.sfd[1]); in TEST()
2254 struct epoll_event e; in TEST() local
2261 ctx.efd[0] = epoll_create(1); in TEST()
2264 ctx.efd[1] = epoll_create(1); in TEST()
2265 ASSERT_GE(ctx.efd[1], 0); in TEST()
2267 e.events = EPOLLIN; in TEST()
2268 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2270 e.events = EPOLLIN; in TEST()
2271 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2277 pfd.fd = ctx.efd[1]; in TEST()
2279 if (poll(&pfd, 1, -1) > 0) { in TEST()
2280 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2281 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2293 close(ctx.efd[1]); in TEST()
2295 close(ctx.sfd[1]); in TEST()
2310 struct epoll_event e; in TEST() local
2317 ctx.efd[0] = epoll_create(1); in TEST()
2320 ctx.efd[1] = epoll_create(1); in TEST()
2321 ASSERT_GE(ctx.efd[1], 0); in TEST()
2323 e.events = EPOLLIN | EPOLLET; in TEST()
2324 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2326 e.events = EPOLLIN; in TEST()
2327 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2333 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2345 close(ctx.efd[1]); in TEST()
2347 close(ctx.sfd[1]); in TEST()
2363 struct epoll_event e; in TEST() local
2370 ctx.efd[0] = epoll_create(1); in TEST()
2373 ctx.efd[1] = epoll_create(1); in TEST()
2374 ASSERT_GE(ctx.efd[1], 0); in TEST()
2376 e.events = EPOLLIN; in TEST()
2377 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2379 e.events = EPOLLIN | EPOLLET; in TEST()
2380 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2386 pfd.fd = ctx.efd[1]; in TEST()
2388 if (poll(&pfd, 1, -1) > 0) { in TEST()
2389 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2390 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2402 close(ctx.efd[1]); in TEST()
2404 close(ctx.sfd[1]); in TEST()
2419 struct epoll_event e; in TEST() local
2426 ctx.efd[0] = epoll_create(1); in TEST()
2429 ctx.efd[1] = epoll_create(1); in TEST()
2430 ASSERT_GE(ctx.efd[1], 0); in TEST()
2432 e.events = EPOLLIN | EPOLLET; in TEST()
2433 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2435 e.events = EPOLLIN | EPOLLET; in TEST()
2436 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2442 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2454 close(ctx.efd[1]); in TEST()
2456 close(ctx.sfd[1]); in TEST()
2477 efd[0] = epoll_create(1); in TEST()
2480 efd[1] = epoll_create(1); in TEST()
2481 ASSERT_GE(efd[1], 0); in TEST()
2483 efd[2] = epoll_create(1); in TEST()
2487 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2493 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2498 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
2499 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
2505 close(efd[1]); in TEST()
2508 close(sfd[1]); in TEST()
2531 efd[0] = epoll_create(1); in TEST()
2534 efd[1] = epoll_create(1); in TEST()
2535 ASSERT_GE(efd[1], 0); in TEST()
2537 efd[2] = epoll_create(1); in TEST()
2541 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2547 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2552 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
2553 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
2559 close(efd[1]); in TEST()
2562 close(sfd[1]); in TEST()
2586 efd[0] = epoll_create(1); in TEST()
2589 efd[1] = epoll_create(1); in TEST()
2590 ASSERT_GE(efd[1], 0); in TEST()
2592 efd[2] = epoll_create(1); in TEST()
2596 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2602 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2607 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
2608 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
2612 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2617 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2621 close(efd[1]); in TEST()
2624 close(sfd[1]); in TEST()
2648 efd[0] = epoll_create(1); in TEST()
2651 efd[1] = epoll_create(1); in TEST()
2652 ASSERT_GE(efd[1], 0); in TEST()
2654 efd[2] = epoll_create(1); in TEST()
2658 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2664 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2669 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
2670 ASSERT_EQ(write(sfd[3], "w", 1), 1); in TEST()
2674 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2679 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
2683 close(efd[1]); in TEST()
2686 close(sfd[1]); in TEST()
2703 struct epoll_event e; in TEST() local
2711 ctx.efd[0] = epoll_create(1); in TEST()
2714 ctx.efd[1] = epoll_create(1); in TEST()
2715 ASSERT_GE(ctx.efd[1], 0); in TEST()
2717 ctx.efd[2] = epoll_create(1); in TEST()
2720 e.events = EPOLLIN; in TEST()
2721 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2723 e.events = EPOLLIN; in TEST()
2724 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2726 e.events = EPOLLIN; in TEST()
2727 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2729 e.events = EPOLLIN; in TEST()
2730 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2736 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2737 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2748 close(ctx.efd[1]); in TEST()
2751 close(ctx.sfd[1]); in TEST()
2768 struct epoll_event e; in TEST() local
2776 ctx.efd[0] = epoll_create(1); in TEST()
2779 ctx.efd[1] = epoll_create(1); in TEST()
2780 ASSERT_GE(ctx.efd[1], 0); in TEST()
2782 ctx.efd[2] = epoll_create(1); in TEST()
2785 e.events = EPOLLIN; in TEST()
2786 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2788 e.events = EPOLLIN; in TEST()
2789 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2791 e.events = EPOLLIN | EPOLLET; in TEST()
2792 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2794 e.events = EPOLLIN | EPOLLET; in TEST()
2795 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2801 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2802 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2813 close(ctx.efd[1]); in TEST()
2816 close(ctx.sfd[1]); in TEST()
2833 struct epoll_event e; in TEST() local
2841 ctx.efd[0] = epoll_create(1); in TEST()
2844 ctx.efd[1] = epoll_create(1); in TEST()
2845 ASSERT_GE(ctx.efd[1], 0); in TEST()
2847 ctx.efd[2] = epoll_create(1); in TEST()
2850 e.events = EPOLLIN; in TEST()
2851 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2853 e.events = EPOLLIN; in TEST()
2854 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2856 e.events = EPOLLIN; in TEST()
2857 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2859 e.events = EPOLLIN; in TEST()
2860 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2866 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2867 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2878 close(ctx.efd[1]); in TEST()
2881 close(ctx.sfd[1]); in TEST()
2898 struct epoll_event e; in TEST() local
2906 ctx.efd[0] = epoll_create(1); in TEST()
2909 ctx.efd[1] = epoll_create(1); in TEST()
2910 ASSERT_GE(ctx.efd[1], 0); in TEST()
2912 ctx.efd[2] = epoll_create(1); in TEST()
2915 e.events = EPOLLIN; in TEST()
2916 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2918 e.events = EPOLLIN; in TEST()
2919 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2921 e.events = EPOLLIN | EPOLLET; in TEST()
2922 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2924 e.events = EPOLLIN | EPOLLET; in TEST()
2925 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2931 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2932 __sync_fetch_and_add(&ctx.count, 1); in TEST()
2943 close(ctx.efd[1]); in TEST()
2946 close(ctx.sfd[1]); in TEST()
2964 struct epoll_event e; in TEST() local
2972 ctx.efd[0] = epoll_create(1); in TEST()
2975 ctx.efd[1] = epoll_create(1); in TEST()
2976 ASSERT_GE(ctx.efd[1], 0); in TEST()
2978 ctx.efd[2] = epoll_create(1); in TEST()
2981 e.events = EPOLLIN; in TEST()
2982 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
2984 e.events = EPOLLIN; in TEST()
2985 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
2987 e.events = EPOLLIN; in TEST()
2988 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
2990 e.events = EPOLLIN; in TEST()
2991 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
2999 if (poll(&pfd, 1, -1) > 0) { in TEST()
3000 if (epoll_wait(ctx.efd[0], &e, 1, 0) > 0) in TEST()
3001 __sync_fetch_and_add(&ctx.count, 1); in TEST()
3013 close(ctx.efd[1]); in TEST()
3016 close(ctx.sfd[1]); in TEST()
3034 struct epoll_event e; in TEST() local
3042 ctx.efd[0] = epoll_create(1); in TEST()
3045 ctx.efd[1] = epoll_create(1); in TEST()
3046 ASSERT_GE(ctx.efd[1], 0); in TEST()
3048 ctx.efd[2] = epoll_create(1); in TEST()
3051 e.events = EPOLLIN; in TEST()
3052 ASSERT_EQ(epoll_ctl(ctx.efd[1], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3054 e.events = EPOLLIN; in TEST()
3055 ASSERT_EQ(epoll_ctl(ctx.efd[2], EPOLL_CTL_ADD, ctx.sfd[2], &e), 0); in TEST()
3057 e.events = EPOLLIN | EPOLLET; in TEST()
3058 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[1], &e), 0); in TEST()
3060 e.events = EPOLLIN | EPOLLET; in TEST()
3061 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.efd[2], &e), 0); in TEST()
3069 if (poll(&pfd, 1, -1) > 0) { in TEST()
3070 if (epoll_wait(ctx.efd[0], &e, 1, 0) > 0) in TEST()
3071 __sync_fetch_and_add(&ctx.count, 1); in TEST()
3083 close(ctx.efd[1]); in TEST()
3086 close(ctx.sfd[1]); in TEST()
3094 struct epoll_event e; in epoll59_thread() local
3101 e.events = EPOLLIN | EPOLLERR | EPOLLET; in epoll59_thread()
3102 epoll_ctl(ctx->efd[0], EPOLL_CTL_MOD, ctx->sfd[0], &e); in epoll59_thread()
3122 struct epoll_event e; in TEST() local
3131 ctx.sfd[0] = eventfd(1, 0); in TEST()
3134 e.events = EPOLLIN | EPOLLERR | EPOLLET; in TEST()
3135 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3140 ret = epoll_wait(ctx.efd[0], &e, 1, 1000); in TEST()
3145 ctx.count = 1; in TEST()
3170 struct epoll_event e; in epoll60_wait_thread() local
3185 __atomic_fetch_add(&ctx->ready, 1, __ATOMIC_ACQUIRE); in epoll60_wait_thread()
3192 __atomic_fetch_add(&ctx->waiters, 1, __ATOMIC_ACQUIRE); in epoll60_wait_thread()
3194 ret = epoll_pwait(ctx->epfd, &e, 1, 2000, &sigmask); in epoll60_wait_thread()
3195 if (ret != 1) { in epoll60_wait_thread()
3202 ret = read(e.data.fd, &v, sizeof(v)); in epoll60_wait_thread()
3206 __atomic_fetch_sub(&ctx->waiters, 1, __ATOMIC_RELEASE); in epoll60_wait_thread()
3233 struct epoll_event e; in TEST() local
3246 e.events = EPOLLIN | EPOLLET; in TEST()
3247 e.data.fd = ctx.evfd[i]; in TEST()
3248 ASSERT_EQ(epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd[i], &e), 0); in TEST()
3257 uint64_t v = 1, ms; in TEST()
3272 /* 1ms should be enough to schedule away */ in TEST()
3281 /* Busy loop for 1s and wait for all waiters to wake up */ in TEST()
3288 ctx.stopped = 1; in TEST()
3308 int64_t l = 1; in epoll61_write_eventfd()
3318 struct epoll_event events[1]; in epoll61_epoll_with_timeout()
3321 n = epoll_wait(ctx->epfd, events, 1, 11); in epoll61_epoll_with_timeout()
3326 if (n == 1) { in epoll61_epoll_with_timeout()
3327 int64_t l = 1; in epoll61_epoll_with_timeout()
3337 struct epoll_event events[1]; in epoll61_blocking_epoll()
3339 epoll_wait(ctx->epfd, events, 1, -1); in epoll61_blocking_epoll()
3369 * Thread 1 sleeps for 10.9ms and writes to the evenfd. in TEST()
3371 * Thread 3 calls epoll with a timeout of -1. in TEST()
3373 * The eventfd write by Thread 1 should either wakeup Thread 2 in TEST()
3382 ASSERT_EQ(pthread_create(&threads[1], NULL, in TEST()
3400 struct epoll_event e; in TEST() local
3404 efd = epoll_create(1); in TEST()
3407 e.events = EPOLLIN; in TEST()
3408 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
3410 ASSERT_EQ(write(sfd[1], "w", 1), 1); in TEST()
3412 EXPECT_EQ(sys_epoll_pwait2(efd, &e, 1, NULL, NULL, 0), 1); in TEST()
3413 EXPECT_EQ(sys_epoll_pwait2(efd, &e, 1, NULL, NULL, 0), 1); in TEST()
3417 close(sfd[1]); in TEST()
3428 struct epoll_event e; in TEST() local
3432 efd = epoll_create(1); in TEST()
3435 e.events = EPOLLIN; in TEST()
3436 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
3442 EXPECT_EQ(sys_epoll_pwait2(efd, &e, 1, &ts, NULL, 0), 0); in TEST()
3449 close(sfd[1]); in TEST()
3462 struct epoll_event e; in TEST() local
3469 ctx.efd[0] = epoll_create(1); in TEST()
3472 e.events = EPOLLIN; in TEST()
3473 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], &e), 0); in TEST()
3481 ASSERT_EQ(pthread_create(&waiter[1], NULL, waiter_entry1a, &ctx), 0); in TEST()
3484 ASSERT_EQ(write(ctx.sfd[1], "w", 1), 1); in TEST()
3487 ASSERT_EQ(pthread_join(waiter[1], NULL), 0); in TEST()
3493 close(ctx.sfd[1]); in TEST()