Lines Matching +full:0 +full:e

52 	struct epoll_event e;  in waiter_entry1a()  local
55 if (epoll_wait(ctx->efd[0], &e, 1, -1) > 0) in waiter_entry1a()
64 struct epoll_event e; in waiter_entry1ap() local
67 pfd.fd = ctx->efd[0]; in waiter_entry1ap()
69 if (poll(&pfd, 1, -1) > 0) { in waiter_entry1ap()
70 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) 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()
91 struct epoll_event e; in waiter_entry1op() local
94 pfd.fd = ctx->efd[0]; in waiter_entry1op()
96 if (poll(&pfd, 1, -1) > 0) { in waiter_entry1op()
97 if (epoll_wait(ctx->efd[0], &e, 1, 0) > 0) in waiter_entry1op()
109 if (epoll_wait(ctx->efd[0], events, 2, -1) > 0) in waiter_entry2a()
121 pfd.fd = ctx->efd[0]; in waiter_entry2ap()
123 if (poll(&pfd, 1, -1) > 0) { in waiter_entry2ap()
124 if (epoll_wait(ctx->efd[0], events, 2, 0) > 0) in waiter_entry2ap()
167 struct epoll_event e; in TEST() local
169 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
172 ASSERT_GE(efd, 0); in TEST()
174 e.events = EPOLLIN; in TEST()
175 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); 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()
183 close(sfd[0]); in TEST()
198 struct epoll_event e; in TEST() local
200 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
203 ASSERT_GE(efd, 0); in TEST()
205 e.events = EPOLLIN | EPOLLET; in TEST()
206 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); 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()
214 close(sfd[0]); in TEST()
231 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
232 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
235 ASSERT_GE(efd, 0); in TEST()
237 events[0].events = EPOLLIN; in TEST()
238 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
240 events[0].events = EPOLLIN; in TEST()
241 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
246 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
247 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
250 close(sfd[0]); in TEST()
269 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
270 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
273 ASSERT_GE(efd, 0); in TEST()
275 events[0].events = EPOLLIN | EPOLLET; in TEST()
276 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
278 events[0].events = EPOLLIN | EPOLLET; in TEST()
279 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
284 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
285 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 0); in TEST()
288 close(sfd[0]); in TEST()
306 struct epoll_event e; in TEST() local
308 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
311 ASSERT_GE(efd, 0); in TEST()
313 e.events = EPOLLIN; in TEST()
314 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); 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()
329 close(sfd[0]); in TEST()
345 struct epoll_event e; in TEST() local
347 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
350 ASSERT_GE(efd, 0); in TEST()
352 e.events = EPOLLIN | EPOLLET; in TEST()
353 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); 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()
368 close(sfd[0]); in TEST()
387 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
388 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
391 ASSERT_GE(efd, 0); in TEST()
393 events[0].events = EPOLLIN; in TEST()
394 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
396 events[0].events = EPOLLIN; in TEST()
397 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
404 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
405 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
409 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
410 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
413 close(sfd[0]); in TEST()
433 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
434 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
437 ASSERT_GE(efd, 0); in TEST()
439 events[0].events = EPOLLIN | EPOLLET; in TEST()
440 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
442 events[0].events = EPOLLIN | EPOLLET; in TEST()
443 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
450 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
451 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 2); in TEST()
455 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
456 EXPECT_EQ(epoll_wait(efd, events, 2, 0), 0); in TEST()
459 close(sfd[0]); in TEST()
475 struct epoll_event e; in TEST() local
476 struct epoll_mtcontext ctx = { 0 }; in TEST()
480 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
482 ctx.efd[0] = epoll_create(1); in TEST()
483 ASSERT_GE(ctx.efd[0], 0); 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()
489 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
490 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
492 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
495 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
498 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
503 close(ctx.efd[0]); in TEST()
504 close(ctx.sfd[0]); in TEST()
518 struct epoll_event e; in TEST() local
519 struct epoll_mtcontext ctx = { 0 }; in TEST()
523 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
525 ctx.efd[0] = epoll_create(1); in TEST()
526 ASSERT_GE(ctx.efd[0], 0); 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()
532 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
533 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
535 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
538 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
541 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
546 close(ctx.efd[0]); in TEST()
547 close(ctx.sfd[0]); in TEST()
562 struct epoll_mtcontext ctx = { 0 }; in TEST()
566 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
567 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
569 ctx.efd[0] = epoll_create(1); in TEST()
570 ASSERT_GE(ctx.efd[0], 0); in TEST()
572 events[0].events = EPOLLIN; in TEST()
573 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
575 events[0].events = EPOLLIN; in TEST()
576 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
579 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry2a, &ctx), 0); in TEST()
580 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
582 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
585 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
588 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
593 close(ctx.efd[0]); in TEST()
594 close(ctx.sfd[0]); in TEST()
611 struct epoll_mtcontext ctx = { 0 }; in TEST()
615 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
616 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
618 ctx.efd[0] = epoll_create(1); in TEST()
619 ASSERT_GE(ctx.efd[0], 0); in TEST()
621 events[0].events = EPOLLIN | EPOLLET; in TEST()
622 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
624 events[0].events = EPOLLIN | EPOLLET; in TEST()
625 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
628 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
629 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
631 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
634 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
637 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
642 close(ctx.efd[0]); in TEST()
643 close(ctx.sfd[0]); in TEST()
659 struct epoll_event e; in TEST() local
660 struct epoll_mtcontext ctx = { 0 }; in TEST()
664 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
666 ctx.efd[0] = epoll_create(1); in TEST()
667 ASSERT_GE(ctx.efd[0], 0); 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()
673 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
674 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
676 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
679 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
682 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
687 close(ctx.efd[0]); in TEST()
688 close(ctx.sfd[0]); in TEST()
702 struct epoll_event e; in TEST() local
703 struct epoll_mtcontext ctx = { 0 }; in TEST()
707 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
709 ctx.efd[0] = epoll_create(1); in TEST()
710 ASSERT_GE(ctx.efd[0], 0); 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()
716 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
717 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
719 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
722 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
725 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
730 close(ctx.efd[0]); in TEST()
731 close(ctx.sfd[0]); in TEST()
746 struct epoll_mtcontext ctx = { 0 }; in TEST()
750 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
751 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
753 ctx.efd[0] = epoll_create(1); in TEST()
754 ASSERT_GE(ctx.efd[0], 0); in TEST()
756 events[0].events = EPOLLIN; in TEST()
757 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
759 events[0].events = EPOLLIN; in TEST()
760 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
763 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry2ap, &ctx), 0); in TEST()
764 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
766 if (epoll_wait(ctx.efd[0], events, 2, -1) > 0) in TEST()
769 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
772 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
777 close(ctx.efd[0]); in TEST()
778 close(ctx.sfd[0]); in TEST()
795 struct epoll_mtcontext ctx = { 0 }; in TEST()
799 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
800 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
802 ctx.efd[0] = epoll_create(1); in TEST()
803 ASSERT_GE(ctx.efd[0], 0); in TEST()
805 events[0].events = EPOLLIN | EPOLLET; in TEST()
806 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[0], events), 0); in TEST()
808 events[0].events = EPOLLIN | EPOLLET; in TEST()
809 ASSERT_EQ(epoll_ctl(ctx.efd[0], EPOLL_CTL_ADD, ctx.sfd[2], events), 0); in TEST()
812 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
813 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
815 if (epoll_wait(ctx.efd[0], events, 1, -1) > 0) in TEST()
818 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
821 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
826 close(ctx.efd[0]); in TEST()
827 close(ctx.sfd[0]); in TEST()
846 struct epoll_event e; in TEST() local
848 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
850 efd[0] = epoll_create(1); in TEST()
851 ASSERT_GE(efd[0], 0); 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()
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()
867 close(efd[0]); in TEST()
869 close(sfd[0]); in TEST()
886 struct epoll_event e; in TEST() local
888 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
890 efd[0] = epoll_create(1); in TEST()
891 ASSERT_GE(efd[0], 0); 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()
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()
907 close(efd[0]); in TEST()
909 close(sfd[0]); in TEST()
926 struct epoll_event e; in TEST() local
928 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
930 efd[0] = epoll_create(1); in TEST()
931 ASSERT_GE(efd[0], 0); 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()
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()
947 close(efd[0]); in TEST()
949 close(sfd[0]); in TEST()
966 struct epoll_event e; in TEST() local
968 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
970 efd[0] = epoll_create(1); in TEST()
971 ASSERT_GE(efd[0], 0); 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()
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()
987 close(efd[0]); in TEST()
989 close(sfd[0]); in TEST()
1007 struct epoll_event e; in TEST() local
1009 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
1011 efd[0] = epoll_create(1); in TEST()
1012 ASSERT_GE(efd[0], 0); 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()
1025 pfd.fd = efd[0]; 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()
1030 pfd.fd = efd[0]; 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()
1035 close(efd[0]); in TEST()
1037 close(sfd[0]); in TEST()
1055 struct epoll_event e; in TEST() local
1057 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
1059 efd[0] = epoll_create(1); in TEST()
1060 ASSERT_GE(efd[0], 0); 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()
1073 pfd.fd = efd[0]; 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()
1078 pfd.fd = efd[0]; 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()
1083 close(efd[0]); in TEST()
1085 close(sfd[0]); in TEST()
1103 struct epoll_event e; in TEST() local
1105 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
1107 efd[0] = epoll_create(1); in TEST()
1108 ASSERT_GE(efd[0], 0); 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()
1121 pfd.fd = efd[0]; 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()
1126 pfd.fd = efd[0]; 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()
1131 close(efd[0]); in TEST()
1133 close(sfd[0]); in TEST()
1151 struct epoll_event e; in TEST() local
1153 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
1155 efd[0] = epoll_create(1); in TEST()
1156 ASSERT_GE(efd[0], 0); 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()
1169 pfd.fd = efd[0]; 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()
1174 pfd.fd = efd[0]; 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()
1179 close(efd[0]); in TEST()
1181 close(sfd[0]); in TEST()
1197 struct epoll_event e; in TEST() local
1198 struct epoll_mtcontext ctx = { 0 }; in TEST()
1202 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1204 ctx.efd[0] = epoll_create(1); in TEST()
1205 ASSERT_GE(ctx.efd[0], 0); 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()
1217 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1218 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1220 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1223 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1226 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1231 close(ctx.efd[0]); in TEST()
1233 close(ctx.sfd[0]); in TEST()
1249 struct epoll_event e; in TEST() local
1250 struct epoll_mtcontext ctx = { 0 }; in TEST()
1254 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1256 ctx.efd[0] = epoll_create(1); in TEST()
1257 ASSERT_GE(ctx.efd[0], 0); 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()
1269 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1270 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1272 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1275 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1278 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1283 close(ctx.efd[0]); in TEST()
1285 close(ctx.sfd[0]); in TEST()
1301 struct epoll_event e; in TEST() local
1302 struct epoll_mtcontext ctx = { 0 }; in TEST()
1306 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1308 ctx.efd[0] = epoll_create(1); in TEST()
1309 ASSERT_GE(ctx.efd[0], 0); 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()
1321 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1322 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1324 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1327 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1330 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1335 close(ctx.efd[0]); in TEST()
1337 close(ctx.sfd[0]); in TEST()
1353 struct epoll_event e; in TEST() local
1354 struct epoll_mtcontext ctx = { 0 }; in TEST()
1358 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1360 ctx.efd[0] = epoll_create(1); in TEST()
1361 ASSERT_GE(ctx.efd[0], 0); 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()
1373 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1374 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1376 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1379 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1382 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1387 close(ctx.efd[0]); in TEST()
1389 close(ctx.sfd[0]); in TEST()
1405 struct epoll_event e; in TEST() local
1406 struct epoll_mtcontext ctx = { 0 }; in TEST()
1410 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1412 ctx.efd[0] = epoll_create(1); in TEST()
1413 ASSERT_GE(ctx.efd[0], 0); 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()
1425 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1426 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1428 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1431 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1434 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1439 close(ctx.efd[0]); in TEST()
1440 close(ctx.sfd[0]); in TEST()
1456 struct epoll_event e; in TEST() local
1457 struct epoll_mtcontext ctx = { 0 }; in TEST()
1461 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1463 ctx.efd[0] = epoll_create(1); in TEST()
1464 ASSERT_GE(ctx.efd[0], 0); 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()
1476 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1477 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1479 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1482 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1485 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1490 close(ctx.efd[0]); in TEST()
1491 close(ctx.sfd[0]); in TEST()
1507 struct epoll_event e; in TEST() local
1508 struct epoll_mtcontext ctx = { 0 }; in TEST()
1512 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1514 ctx.efd[0] = epoll_create(1); in TEST()
1515 ASSERT_GE(ctx.efd[0], 0); 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()
1527 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1528 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1530 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1533 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1536 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1541 close(ctx.efd[0]); in TEST()
1542 close(ctx.sfd[0]); in TEST()
1558 struct epoll_event e; in TEST() local
1559 struct epoll_mtcontext ctx = { 0 }; in TEST()
1563 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1565 ctx.efd[0] = epoll_create(1); in TEST()
1566 ASSERT_GE(ctx.efd[0], 0); 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()
1578 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
1579 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1581 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
1584 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1587 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1592 close(ctx.efd[0]); in TEST()
1593 close(ctx.sfd[0]); in TEST()
1609 struct epoll_event e; in TEST() local
1610 struct epoll_mtcontext ctx = { 0 }; in TEST()
1614 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1616 ctx.efd[0] = epoll_create(1); in TEST()
1617 ASSERT_GE(ctx.efd[0], 0); 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()
1629 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1630 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1632 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1635 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1638 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1643 close(ctx.efd[0]); in TEST()
1645 close(ctx.sfd[0]); in TEST()
1661 struct epoll_event e; in TEST() local
1662 struct epoll_mtcontext ctx = { 0 }; in TEST()
1666 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1668 ctx.efd[0] = epoll_create(1); in TEST()
1669 ASSERT_GE(ctx.efd[0], 0); 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()
1681 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1682 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1684 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1687 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1690 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1695 close(ctx.efd[0]); in TEST()
1697 close(ctx.sfd[0]); in TEST()
1713 struct epoll_event e; in TEST() local
1714 struct epoll_mtcontext ctx = { 0 }; in TEST()
1718 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1720 ctx.efd[0] = epoll_create(1); in TEST()
1721 ASSERT_GE(ctx.efd[0], 0); 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()
1733 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1734 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1736 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1739 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1742 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1747 close(ctx.efd[0]); in TEST()
1749 close(ctx.sfd[0]); in TEST()
1765 struct epoll_event e; in TEST() local
1766 struct epoll_mtcontext ctx = { 0 }; in TEST()
1770 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1772 ctx.efd[0] = epoll_create(1); in TEST()
1773 ASSERT_GE(ctx.efd[0], 0); 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()
1785 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1786 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1788 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
1791 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1794 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1799 close(ctx.efd[0]); in TEST()
1801 close(ctx.sfd[0]); in TEST()
1818 struct epoll_event e; in TEST() local
1819 struct epoll_mtcontext ctx = { 0 }; in TEST()
1823 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1825 ctx.efd[0] = epoll_create(1); in TEST()
1826 ASSERT_GE(ctx.efd[0], 0); 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()
1838 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1839 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1843 if (poll(&pfd, 1, -1) > 0) { in TEST()
1844 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1848 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1851 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1856 close(ctx.efd[0]); in TEST()
1858 close(ctx.sfd[0]); in TEST()
1875 struct epoll_event e; in TEST() local
1876 struct epoll_mtcontext ctx = { 0 }; in TEST()
1880 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1882 ctx.efd[0] = epoll_create(1); in TEST()
1883 ASSERT_GE(ctx.efd[0], 0); 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()
1895 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
1896 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1900 if (poll(&pfd, 1, -1) > 0) { in TEST()
1901 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1905 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1908 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1913 close(ctx.efd[0]); in TEST()
1915 close(ctx.sfd[0]); in TEST()
1932 struct epoll_event e; in TEST() local
1933 struct epoll_mtcontext ctx = { 0 }; in TEST()
1937 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1939 ctx.efd[0] = epoll_create(1); in TEST()
1940 ASSERT_GE(ctx.efd[0], 0); 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()
1952 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
1953 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
1957 if (poll(&pfd, 1, -1) > 0) { in TEST()
1958 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
1962 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
1965 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
1970 close(ctx.efd[0]); in TEST()
1972 close(ctx.sfd[0]); in TEST()
1989 struct epoll_event e; in TEST() local
1990 struct epoll_mtcontext ctx = { 0 }; in TEST()
1994 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
1996 ctx.efd[0] = epoll_create(1); in TEST()
1997 ASSERT_GE(ctx.efd[0], 0); 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()
2009 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1o, &ctx), 0); in TEST()
2010 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2014 if (poll(&pfd, 1, -1) > 0) { in TEST()
2015 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2019 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2022 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2027 close(ctx.efd[0]); in TEST()
2029 close(ctx.sfd[0]); in TEST()
2045 struct epoll_event e; in TEST() local
2046 struct epoll_mtcontext ctx = { 0 }; in TEST()
2050 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2052 ctx.efd[0] = epoll_create(1); in TEST()
2053 ASSERT_GE(ctx.efd[0], 0); 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()
2065 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2066 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2068 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2071 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2074 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2079 close(ctx.efd[0]); in TEST()
2081 close(ctx.sfd[0]); in TEST()
2097 struct epoll_event e; in TEST() local
2098 struct epoll_mtcontext ctx = { 0 }; in TEST()
2102 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2104 ctx.efd[0] = epoll_create(1); in TEST()
2105 ASSERT_GE(ctx.efd[0], 0); 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()
2117 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2118 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2120 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2123 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2126 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2131 close(ctx.efd[0]); in TEST()
2133 close(ctx.sfd[0]); in TEST()
2149 struct epoll_event e; in TEST() local
2150 struct epoll_mtcontext ctx = { 0 }; in TEST()
2154 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2156 ctx.efd[0] = epoll_create(1); in TEST()
2157 ASSERT_GE(ctx.efd[0], 0); 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()
2169 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2170 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2172 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2175 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2178 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2183 close(ctx.efd[0]); in TEST()
2185 close(ctx.sfd[0]); in TEST()
2201 struct epoll_event e; in TEST() local
2202 struct epoll_mtcontext ctx = { 0 }; in TEST()
2206 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2208 ctx.efd[0] = epoll_create(1); in TEST()
2209 ASSERT_GE(ctx.efd[0], 0); 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()
2221 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2222 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2224 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2227 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2230 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2235 close(ctx.efd[0]); in TEST()
2237 close(ctx.sfd[0]); in TEST()
2254 struct epoll_event e; in TEST() local
2255 struct epoll_mtcontext ctx = { 0 }; in TEST()
2259 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2261 ctx.efd[0] = epoll_create(1); in TEST()
2262 ASSERT_GE(ctx.efd[0], 0); 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()
2274 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2275 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2279 if (poll(&pfd, 1, -1) > 0) { in TEST()
2280 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2284 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2287 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2292 close(ctx.efd[0]); in TEST()
2294 close(ctx.sfd[0]); in TEST()
2310 struct epoll_event e; in TEST() local
2311 struct epoll_mtcontext ctx = { 0 }; in TEST()
2315 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2317 ctx.efd[0] = epoll_create(1); in TEST()
2318 ASSERT_GE(ctx.efd[0], 0); 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()
2330 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2331 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2333 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2336 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2339 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2344 close(ctx.efd[0]); in TEST()
2346 close(ctx.sfd[0]); in TEST()
2363 struct epoll_event e; in TEST() local
2364 struct epoll_mtcontext ctx = { 0 }; in TEST()
2368 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2370 ctx.efd[0] = epoll_create(1); in TEST()
2371 ASSERT_GE(ctx.efd[0], 0); 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()
2383 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2384 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2388 if (poll(&pfd, 1, -1) > 0) { in TEST()
2389 if (epoll_wait(ctx.efd[1], &e, 1, 0) > 0) in TEST()
2393 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2396 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2401 close(ctx.efd[0]); in TEST()
2403 close(ctx.sfd[0]); in TEST()
2419 struct epoll_event e; in TEST() local
2420 struct epoll_mtcontext ctx = { 0 }; in TEST()
2424 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
2426 ctx.efd[0] = epoll_create(1); in TEST()
2427 ASSERT_GE(ctx.efd[0], 0); 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()
2439 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1op, &ctx), 0); in TEST()
2440 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry1, &ctx), 0); in TEST()
2442 if (epoll_wait(ctx.efd[1], &e, 1, -1) > 0) in TEST()
2445 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2448 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2453 close(ctx.efd[0]); in TEST()
2455 close(ctx.sfd[0]); in TEST()
2474 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
2475 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
2477 efd[0] = epoll_create(1); in TEST()
2478 ASSERT_GE(efd[0], 0); in TEST()
2481 ASSERT_GE(efd[1], 0); in TEST()
2484 ASSERT_GE(efd[2], 0); in TEST()
2486 events[0].events = EPOLLIN; in TEST()
2487 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2489 events[0].events = EPOLLIN; in TEST()
2490 ASSERT_EQ(epoll_ctl(efd[2], EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
2492 events[0].events = EPOLLIN; in TEST()
2493 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2495 events[0].events = EPOLLIN; in TEST()
2496 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[2], events), 0); in TEST()
2501 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2502 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2504 close(efd[0]); in TEST()
2507 close(sfd[0]); in TEST()
2528 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
2529 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
2531 efd[0] = epoll_create(1); in TEST()
2532 ASSERT_GE(efd[0], 0); in TEST()
2535 ASSERT_GE(efd[1], 0); in TEST()
2538 ASSERT_GE(efd[2], 0); in TEST()
2540 events[0].events = EPOLLIN; in TEST()
2541 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2543 events[0].events = EPOLLIN; in TEST()
2544 ASSERT_EQ(epoll_ctl(efd[2], EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
2546 events[0].events = EPOLLIN | EPOLLET; in TEST()
2547 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2549 events[0].events = EPOLLIN | EPOLLET; in TEST()
2550 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[2], events), 0); in TEST()
2555 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2556 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 0); in TEST()
2558 close(efd[0]); in TEST()
2561 close(sfd[0]); in TEST()
2583 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
2584 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
2586 efd[0] = epoll_create(1); in TEST()
2587 ASSERT_GE(efd[0], 0); in TEST()
2590 ASSERT_GE(efd[1], 0); in TEST()
2593 ASSERT_GE(efd[2], 0); in TEST()
2595 events[0].events = EPOLLIN; in TEST()
2596 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2598 events[0].events = EPOLLIN; in TEST()
2599 ASSERT_EQ(epoll_ctl(efd[2], EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
2601 events[0].events = EPOLLIN; in TEST()
2602 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2604 events[0].events = EPOLLIN; in TEST()
2605 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[2], events), 0); in TEST()
2610 pfd.fd = efd[0]; in TEST()
2612 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2613 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2615 pfd.fd = efd[0]; in TEST()
2617 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2618 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2620 close(efd[0]); in TEST()
2623 close(sfd[0]); in TEST()
2645 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[0]), 0); in TEST()
2646 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &sfd[2]), 0); in TEST()
2648 efd[0] = epoll_create(1); in TEST()
2649 ASSERT_GE(efd[0], 0); in TEST()
2652 ASSERT_GE(efd[1], 0); in TEST()
2655 ASSERT_GE(efd[2], 0); in TEST()
2657 events[0].events = EPOLLIN; in TEST()
2658 ASSERT_EQ(epoll_ctl(efd[1], EPOLL_CTL_ADD, sfd[0], events), 0); in TEST()
2660 events[0].events = EPOLLIN; in TEST()
2661 ASSERT_EQ(epoll_ctl(efd[2], EPOLL_CTL_ADD, sfd[2], events), 0); in TEST()
2663 events[0].events = EPOLLIN | EPOLLET; in TEST()
2664 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[1], events), 0); in TEST()
2666 events[0].events = EPOLLIN | EPOLLET; in TEST()
2667 ASSERT_EQ(epoll_ctl(efd[0], EPOLL_CTL_ADD, efd[2], events), 0); in TEST()
2672 pfd.fd = efd[0]; in TEST()
2674 EXPECT_EQ(poll(&pfd, 1, 0), 1); in TEST()
2675 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 2); in TEST()
2677 pfd.fd = efd[0]; in TEST()
2679 EXPECT_EQ(poll(&pfd, 1, 0), 0); in TEST()
2680 EXPECT_EQ(epoll_wait(efd[0], events, 2, 0), 0); in TEST()
2682 close(efd[0]); in TEST()
2685 close(sfd[0]); in TEST()
2703 struct epoll_event e; in TEST() local
2704 struct epoll_mtcontext ctx = { 0 }; in TEST()
2708 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2709 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2711 ctx.efd[0] = epoll_create(1); in TEST()
2712 ASSERT_GE(ctx.efd[0], 0); in TEST()
2715 ASSERT_GE(ctx.efd[1], 0); in TEST()
2718 ASSERT_GE(ctx.efd[2], 0); 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()
2733 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
2734 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2736 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2739 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2742 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2747 close(ctx.efd[0]); in TEST()
2750 close(ctx.sfd[0]); in TEST()
2768 struct epoll_event e; in TEST() local
2769 struct epoll_mtcontext ctx = { 0 }; in TEST()
2773 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2774 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2776 ctx.efd[0] = epoll_create(1); in TEST()
2777 ASSERT_GE(ctx.efd[0], 0); in TEST()
2780 ASSERT_GE(ctx.efd[1], 0); in TEST()
2783 ASSERT_GE(ctx.efd[2], 0); 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()
2798 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1a, &ctx), 0); in TEST()
2799 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2801 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2804 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2807 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2812 close(ctx.efd[0]); in TEST()
2815 close(ctx.sfd[0]); in TEST()
2833 struct epoll_event e; in TEST() local
2834 struct epoll_mtcontext ctx = { 0 }; in TEST()
2838 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2839 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2841 ctx.efd[0] = epoll_create(1); in TEST()
2842 ASSERT_GE(ctx.efd[0], 0); in TEST()
2845 ASSERT_GE(ctx.efd[1], 0); in TEST()
2848 ASSERT_GE(ctx.efd[2], 0); 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()
2863 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2864 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2866 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2869 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2872 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2877 close(ctx.efd[0]); in TEST()
2880 close(ctx.sfd[0]); in TEST()
2898 struct epoll_event e; in TEST() local
2899 struct epoll_mtcontext ctx = { 0 }; in TEST()
2903 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2904 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2906 ctx.efd[0] = epoll_create(1); in TEST()
2907 ASSERT_GE(ctx.efd[0], 0); in TEST()
2910 ASSERT_GE(ctx.efd[1], 0); in TEST()
2913 ASSERT_GE(ctx.efd[2], 0); 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()
2928 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2929 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2931 if (epoll_wait(ctx.efd[0], &e, 1, -1) > 0) in TEST()
2934 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
2937 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
2942 close(ctx.efd[0]); in TEST()
2945 close(ctx.sfd[0]); in TEST()
2964 struct epoll_event e; in TEST() local
2965 struct epoll_mtcontext ctx = { 0 }; in TEST()
2969 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
2970 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
2972 ctx.efd[0] = epoll_create(1); in TEST()
2973 ASSERT_GE(ctx.efd[0], 0); in TEST()
2976 ASSERT_GE(ctx.efd[1], 0); in TEST()
2979 ASSERT_GE(ctx.efd[2], 0); 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()
2994 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
2995 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
2997 pfd.fd = ctx.efd[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()
3004 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
3007 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
3012 close(ctx.efd[0]); in TEST()
3015 close(ctx.sfd[0]); in TEST()
3034 struct epoll_event e; in TEST() local
3035 struct epoll_mtcontext ctx = { 0 }; in TEST()
3039 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[0]), 0); in TEST()
3040 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx.sfd[2]), 0); in TEST()
3042 ctx.efd[0] = epoll_create(1); in TEST()
3043 ASSERT_GE(ctx.efd[0], 0); in TEST()
3046 ASSERT_GE(ctx.efd[1], 0); in TEST()
3049 ASSERT_GE(ctx.efd[2], 0); 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()
3064 ASSERT_EQ(pthread_create(&ctx.waiter, NULL, waiter_entry1ap, &ctx), 0); in TEST()
3065 ASSERT_EQ(pthread_create(&emitter, NULL, emitter_entry2, &ctx), 0); in TEST()
3067 pfd.fd = ctx.efd[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()
3074 ASSERT_EQ(pthread_join(ctx.waiter, NULL), 0); in TEST()
3077 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
3082 close(ctx.efd[0]); in TEST()
3085 close(ctx.sfd[0]); in TEST()
3094 struct epoll_event e; in epoll59_thread() local
3097 for (i = 0; i < 100000; i++) { in epoll59_thread()
3098 while (ctx->count == 0) in epoll59_thread()
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()
3103 ctx->count = 0; in epoll59_thread()
3122 struct epoll_event e; in TEST() local
3123 struct epoll_mtcontext ctx = { 0 }; in TEST()
3128 ctx.efd[0] = epoll_create1(0); in TEST()
3129 ASSERT_GE(ctx.efd[0], 0); in TEST()
3131 ctx.sfd[0] = eventfd(1, 0); in TEST()
3132 ASSERT_GE(ctx.sfd[0], 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()
3137 ASSERT_EQ(pthread_create(&emitter, NULL, epoll59_thread, &ctx), 0); in TEST()
3139 for (i = 0; i < 100000; i++) { in TEST()
3140 ret = epoll_wait(ctx.efd[0], &e, 1, 1000); in TEST()
3141 ASSERT_GT(ret, 0); in TEST()
3143 while (ctx.count != 0) in TEST()
3147 if (pthread_tryjoin_np(emitter, NULL) < 0) { in TEST()
3151 close(ctx.efd[0]); in TEST()
3152 close(ctx.sfd[0]); in TEST()
3170 struct epoll_event e; in epoll60_wait_thread() local
3194 ret = epoll_pwait(ctx->epfd, &e, 1, 2000, &sigmask); in epoll60_wait_thread()
3197 assert(ret < 0 && errno == EINTR && "Lost wakeup!\n"); in epoll60_wait_thread()
3202 ret = read(e.data.fd, &v, sizeof(v)); in epoll60_wait_thread()
3231 struct epoll60_ctx ctx = { 0 }; in TEST()
3233 struct epoll_event e; in TEST() local
3238 ctx.epfd = epoll_create1(0); in TEST()
3239 ASSERT_GE(ctx.epfd, 0); in TEST()
3242 for (i = 0; i < ARRAY_SIZE(ctx.evfd); i++) { in TEST()
3243 ctx.evfd[i] = eventfd(0, EFD_NONBLOCK); in TEST()
3244 ASSERT_GE(ctx.evfd[i], 0); in TEST()
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()
3252 for (i = 0; i < ARRAY_SIZE(waiters); i++) in TEST()
3254 epoll60_wait_thread, &ctx), 0); in TEST()
3256 for (i = 0; i < 300; i++) { in TEST()
3276 for (n = 0; n < ARRAY_SIZE(ctx.evfd); n++) { in TEST()
3286 ASSERT_EQ(count_waiters(&ctx), 0); in TEST()
3290 for (i = 0; i < ARRAY_SIZE(waiters); i++) in TEST()
3292 for (i = 0; i < ARRAY_SIZE(waiters); i++) in TEST()
3295 for (i = 0; i < ARRAY_SIZE(waiters); i++) in TEST()
3349 ctx.epfd = epoll_create1(0); in TEST()
3350 ASSERT_GE(ctx.epfd, 0); in TEST()
3351 ctx.evfd = eventfd(0, EFD_NONBLOCK); in TEST()
3352 ASSERT_GE(ctx.evfd, 0); in TEST()
3357 ASSERT_EQ(r, 0); in TEST()
3363 for (i = 0; i < 1000; i++) { in TEST()
3380 ASSERT_EQ(pthread_create(&threads[0], NULL, in TEST()
3381 epoll61_write_eventfd, &ctx), 0); in TEST()
3383 epoll61_epoll_with_timeout, &ctx), 0); in TEST()
3385 epoll61_blocking_epoll, &ctx), 0); in TEST()
3387 for (n = 0; n < ARRAY_SIZE(threads); ++n) in TEST()
3388 ASSERT_EQ(pthread_join(threads[n], NULL), 0); in TEST()
3400 struct epoll_event e; in TEST() local
3402 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
3405 ASSERT_GE(efd, 0); in TEST()
3407 e.events = EPOLLIN; in TEST()
3408 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); 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()
3416 close(sfd[0]); in TEST()
3428 struct epoll_event e; in TEST() local
3430 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, sfd), 0); in TEST()
3433 ASSERT_GE(efd, 0); in TEST()
3435 e.events = EPOLLIN; in TEST()
3436 ASSERT_EQ(epoll_ctl(efd, EPOLL_CTL_ADD, sfd[0], &e), 0); in TEST()
3438 ts.tv_sec = 0; in TEST()
3442 EXPECT_EQ(sys_epoll_pwait2(efd, &e, 1, &ts, NULL, 0), 0); in TEST()
3448 close(sfd[0]); in TEST()
3462 struct epoll_event e; in TEST() local
3463 struct epoll_mtcontext ctx = { 0 }; in TEST()
3467 ASSERT_EQ(socketpair(AF_UNIX, SOCK_STREAM, 0, ctx.sfd), 0); in TEST()
3469 ctx.efd[0] = epoll_create(1); in TEST()
3470 ASSERT_GE(ctx.efd[0], 0); 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()
3480 ASSERT_EQ(pthread_create(&waiter[0], NULL, waiter_entry1a, &ctx), 0); in TEST()
3481 ASSERT_EQ(pthread_create(&waiter[1], NULL, waiter_entry1a, &ctx), 0); in TEST()
3486 ASSERT_EQ(pthread_join(waiter[0], NULL), 0); in TEST()
3487 ASSERT_EQ(pthread_join(waiter[1], NULL), 0); in TEST()
3491 close(ctx.efd[0]); in TEST()
3492 close(ctx.sfd[0]); in TEST()