/third_party/node/test/wasi/c/ |
H A D | poll.c | 9 struct pollfd fds[4]; in main() local 27 fds[0] = (struct pollfd){.fd = -1, .events = 0, .revents = 0}; in main() 29 ret = poll(fds, 1, 2000); in main() 38 fds[0] = (struct pollfd){.fd = 1, .events = POLLOUT, .revents = 0}; in main() 39 fds[1] = (struct pollfd){.fd = 2, .events = POLLOUT, .revents = 0}; in main() 41 ret = poll(fds, 2, -1); in main() 43 assert(fds[0].revents == POLLOUT); in main() 44 assert(fds[1].revents == POLLOUT); in main() 47 fds[0] = (struct pollfd){.fd = 1, .events = POLLOUT, .revents = 0}; in main() 48 fds[ in main() [all...] |
/third_party/rust/crates/libc/src/unix/solarish/ |
H A D | compat.rs | 43 unsafe fn bail(fdm: ::c_int, fds: ::c_int) -> ::c_int { in bail() 45 if fds >= 0 { in bail() 46 ::close(fds); in bail() 82 let fds = ::open(subordpath, O_RDWR | O_NOCTTY); in openpty() 83 if fds < 0 { in openpty() 88 let setup = ::ioctl(fds, I_FIND, LDTERM.as_ptr()); in openpty() 90 return bail(fdm, fds); in openpty() 94 if ::ioctl(fds, I_PUSH, PTEM.as_ptr()) < 0 || ::ioctl(fds, I_PUSH, LDTERM.as_ptr()) < 0 { in openpty() 95 return bail(fdm, fds); in openpty() 129 let mut fds = -1; forkpty() variables [all...] |
/third_party/ltp/testcases/kernel/syscalls/epoll_wait/ |
H A D | epoll_wait06.c | 32 static int fds[2]; variable 40 SAFE_PIPE2(fds, O_NONBLOCK); in setup() 43 SAFE_FCNTL(fds[1], F_SETPIPE_SZ, write_size); in setup() 51 if (fds[0] > 0) in cleanup() 52 SAFE_CLOSE(fds[0]); in cleanup() 54 if (fds[1] > 0) in cleanup() 55 SAFE_CLOSE(fds[1]); in cleanup() 67 SAFE_EPOLL_CTL(epfd, EPOLL_CTL_ADD, fds[0], &((struct epoll_event) { in run() 69 .data.fd = fds[0], in run() 71 SAFE_EPOLL_CTL(epfd, EPOLL_CTL_ADD, fds[ in run() [all...] |
H A D | epoll_wait01.c | 22 static int write_size, epfd, fds[2]; variable 30 {.fd = fds[1], .events = POLLOUT}, in get_writesize() 36 write_size += SAFE_WRITE(SAFE_WRITE_ANY, fds[1], buf, sizeof(buf)); in get_writesize() 44 SAFE_READ(1, fds[0], read_buf, sizeof(read_buf)); in get_writesize() 58 SAFE_PIPE(fds); in setup() 60 epevs[0].data.fd = fds[0]; in setup() 61 epevs[1].data.fd = fds[1]; in setup() 70 if (epoll_ctl(epfd, EPOLL_CTL_ADD, fds[0], &epevs[0]) || in setup() 71 epoll_ctl(epfd, EPOLL_CTL_ADD, fds[1], &epevs[1])) { in setup() 116 if (ret_evs.data.fd != fds[ in verify_epollout() [all...] |
H A D | epoll_wait07.c | 19 static int fds[2]; variable 27 if (fds[0] > 0) in cleanup() 28 SAFE_CLOSE(fds[0]); in cleanup() 30 if (fds[1] > 0) in cleanup() 31 SAFE_CLOSE(fds[1]); in cleanup() 39 SAFE_PIPE(fds); in run() 45 SAFE_EPOLL_CTL(epfd, EPOLL_CTL_ADD, fds[0], &((struct epoll_event) { in run() 47 .data.fd = fds[0], in run() 52 SAFE_WRITE(0, fds[1], &buff, 1); in run() 55 TST_EXP_EQ_LI(evt_receive.data.fd, fds[ in run() [all...] |
H A D | epoll_wait02.c | 20 static int epfd, fds[2]; variable 44 SAFE_PIPE(fds); in setup() 50 epevs[0].data.fd = fds[0]; in setup() 52 if (epoll_ctl(epfd, EPOLL_CTL_ADD, fds[0], &epevs[0])) in setup() 61 if (fds[0] > 0) in cleanup() 62 SAFE_CLOSE(fds[0]); in cleanup() 64 if (fds[1] > 0) in cleanup() 65 SAFE_CLOSE(fds[1]); in cleanup()
|
/third_party/musl/porting/linux/user/include/fortify/ |
H A D | poll.h | 34 int poll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, int timeout) 36 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amount), 40 size_t bos_fds = __DIAGNOSE_BOS(fds); 42 if (!__DIAGNOSE_BOS_FD_COUNT_TRIVIALLY_SAFE(bos_fds, fds, fd_amount)) { 43 return __poll_chk(fds, fd_amount, timeout, bos_fds); 46 return __DIAGNOSE_CALL_BYPASSING_FORTIFY(poll)(fds, fd_amount, timeout); 51 int ppoll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, 54 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amoun [all...] |
/third_party/musl/include/fortify/linux/ |
H A D | poll.h | 34 int poll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, int timeout) 36 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amount), 40 size_t bos_fds = __DIAGNOSE_BOS(fds); 42 if (!__DIAGNOSE_BOS_FD_COUNT_TRIVIALLY_SAFE(bos_fds, fds, fd_amount)) { 43 return __poll_chk(fds, fd_amount, timeout, bos_fds); 46 return __DIAGNOSE_CALL_BYPASSING_FORTIFY(poll)(fds, fd_amount, timeout); 51 int ppoll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, 54 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amoun [all...] |
/third_party/ltp/testcases/kernel/syscalls/pipe/ |
H A D | pipe12.c | 17 static int fds[2]; variable 47 SAFE_WRITE(SAFE_WRITE_ALL, fds[1], wrbuf, max_size); in verify_pipe() 48 TEST(write(fds[1], "x", 1)); in verify_pipe() 58 SAFE_WRITE(SAFE_WRITE_ALL, fds[1], "x", tc->offset); in verify_pipe() 59 TEST(write(fds[1], wrbuf, invalid_size)); in verify_pipe() 66 SAFE_IOCTL(fds[1], FIONREAD, &nbytes); in verify_pipe() 77 SAFE_READ(0, fds[0], rdbuf, max_size); in verify_pipe() 83 if (fds[0] > 0) in cleanup() 84 SAFE_CLOSE(fds[0]); in cleanup() 85 if (fds[ in cleanup() [all...] |
H A D | pipe14.c | 16 static int fds[2]; variable 24 SAFE_PIPE(fds); in run() 26 SAFE_WRITE(SAFE_WRITE_ALL, fds[1], wrbuf, sizeof(wrbuf)); in run() 27 SAFE_CLOSE(fds[1]); in run() 29 SAFE_READ(0, fds[0], rdbuf, sizeof(wrbuf)); in run() 31 TST_EXP_VAL(SAFE_READ(0, fds[0], rdbuf, 1), 0); in run() 32 SAFE_CLOSE(fds[0]); in run() 37 if (fds[0] > 0) in cleanup() 38 SAFE_CLOSE(fds[0]); in cleanup() 39 if (fds[ in cleanup() [all...] |
H A D | pipe10.c | 18 static int fds[2]; variable 26 SAFE_PIPE(fds); in run() 27 wr_cnt = SAFE_WRITE(SAFE_WRITE_ALL, fds[1], wrbuf, sizeof(wrbuf)); in run() 30 rd_cnt = SAFE_READ(1, fds[0], rdbuf, wr_cnt); in run() 35 SAFE_CLOSE(fds[0]); in run() 36 SAFE_CLOSE(fds[1]); in run() 41 if (fds[0] > 0) in cleanup() 42 SAFE_CLOSE(fds[0]); in cleanup() 44 if (fds[1] > 0) in cleanup() 45 SAFE_CLOSE(fds[ in cleanup() [all...] |
/third_party/ltp/testcases/kernel/syscalls/pipe2/ |
H A D | pipe2_04.c | 19 static int fds[2]; variable 32 SAFE_FCNTL(fds[1], F_SETFL, flags | O_NONBLOCK); in test_pipe2() 33 ret = write(fds[1], "x", 1); in test_pipe2() 45 SAFE_FCNTL(fds[1], F_SETFL, flags & ~O_NONBLOCK); in test_pipe2() 46 SAFE_WRITE(SAFE_WRITE_ALL, fds[1], "x", 1); in test_pipe2() 63 SAFE_PIPE2(fds, O_NONBLOCK); in setup() 66 flags = SAFE_FCNTL(fds[1], F_GETFL); in setup() 74 SAFE_FCNTL(fds[0], F_SETPIPE_SZ, 0); in setup() 80 pipe_size = SAFE_FCNTL(fds[1], F_GETPIPE_SZ); in setup() 87 SAFE_WRITE(SAFE_WRITE_ALL, fds[ in setup() [all...] |
/third_party/ltp/testcases/kernel/syscalls/fchmodat/ |
H A D | fchmodat01.c | 43 static int fds[ARRAY_SIZE(tcases)]; variable 51 TST_EXP_PASS(tst_syscall(__NR_fchmodat, fds[i], filenames[i], 0600), in verify_fchmodat() 55 TST_EXP_FAIL(tst_syscall(__NR_fchmodat, fds[i], filenames[i], 0600), in verify_fchmodat() 76 fds[0] = SAFE_OPEN(pathname, O_DIRECTORY); in setup() 77 fds[1] = fds[4] = fds[0]; in setup() 82 fds[2] = SAFE_OPEN(testfile3, O_CREAT | O_RDWR, 0600); in setup() 83 fds[3] = 100; in setup() 84 fds[ in setup() [all...] |
/third_party/musl/libc-test/src/functionalext/supplement/select/ |
H A D | poll_sup.c | 35 struct pollfd fds[2]; in poll_0100() local 52 fds[0].fd = open(path1, O_RDONLY | O_NONBLOCK); in poll_0100() 53 if (fds[0].fd < 0) { in poll_0100() 56 fds[0].events = POLLIN; in poll_0100() 58 fds[1].fd = open(path2, O_RDONLY | O_NONBLOCK); in poll_0100() 59 if (fds[1].fd < 0) { in poll_0100() 62 fds[1].events = POLLIN; in poll_0100() 64 while (fds[0].events || fds[1].events) { in poll_0100() 65 int ret = poll(fds, in poll_0100() [all...] |
/third_party/ltp/testcases/kernel/syscalls/fcntl/ |
H A D | fcntl30.c | 18 static int fds[2]; variable 23 SAFE_PIPE(fds); in run() 25 TST_EXP_POSITIVE(fcntl(fds[1], F_GETPIPE_SZ)); in run() 27 TST_EXP_POSITIVE(fcntl(fds[1], F_SETPIPE_SZ, max_size_unpriv)); in run() 28 TST_EXP_POSITIVE(fcntl(fds[1], F_GETPIPE_SZ)); in run() 33 SAFE_CLOSE(fds[0]); in run() 34 SAFE_CLOSE(fds[1]); in run() 44 if (fds[0] > 0) in cleanup() 45 SAFE_CLOSE(fds[0]); in cleanup() 46 if (fds[ in cleanup() [all...] |
/third_party/ltp/testcases/kernel/syscalls/pidfd_getfd/ |
H A D | pidfd_getfd01.c | 29 static int fds[2] = {-1, -1}; variable 36 SAFE_CLOSE(fds[0]); in do_child() 38 SAFE_WRITE(SAFE_WRITE_ALL, fds[1], &fd, sizeof(fd)); in do_child() 41 SAFE_CLOSE(fds[1]); in do_child() 49 SAFE_PIPE(fds); in run() 54 SAFE_CLOSE(fds[1]); in run() 58 SAFE_READ(1, fds[0], &targetfd, sizeof(targetfd)); in run() 74 SAFE_CLOSE(fds[0]); in run() 86 if (fds[0] > -1) in cleanup() 87 SAFE_CLOSE(fds[ in cleanup() [all...] |
/third_party/ltp/testcases/kernel/syscalls/futimesat/ |
H A D | futimesat01.c | 55 static int fds[TEST_CASES]; variable 79 TEST(myfutimesat(fds[i], filenames[i], times)); in main() 108 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup() 109 fds[1] = fds[0]; in setup() 114 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup() 116 fds[3] = 100; in setup() 117 fds[4] = AT_FDCWD; in setup() 127 if (fds[0] > 0) in cleanup() 128 close(fds[ in cleanup() [all...] |
/third_party/libwebsockets/lib/plat/freertos/ |
H A D | freertos-service.c | 128 // n = poll(pt->fds, pt->fds_count, timeout_ms); in _lws_plat_service_tsi() 139 pt->fds[n].revents = 0; in _lws_plat_service_tsi() 140 if (pt->fds[n].fd >= max_fd) in _lws_plat_service_tsi() 141 max_fd = pt->fds[n].fd; in _lws_plat_service_tsi() 142 if (pt->fds[n].events & LWS_POLLIN) in _lws_plat_service_tsi() 143 FD_SET(pt->fds[n].fd, &readfds); in _lws_plat_service_tsi() 144 if (pt->fds[n].events & LWS_POLLOUT) in _lws_plat_service_tsi() 145 FD_SET(pt->fds[n].fd, &writefds); in _lws_plat_service_tsi() 146 FD_SET(pt->fds[n].fd, &errfds); in _lws_plat_service_tsi() 158 if (FD_ISSET(pt->fds[ in _lws_plat_service_tsi() [all...] |
/third_party/rust/crates/rustix/tests/net/ |
H A D | poll.rs | 43 let mut fds = [PollFd::new(&data_socket, PollFlags::IN)]; in server() variables 44 assert_eq!(poll(&mut fds, -1).unwrap(), 1); in server() 45 assert!(fds[0].revents().intersects(PollFlags::IN)); in server() 46 assert!(!fds[0].revents().intersects(PollFlags::OUT)); in server() 53 let mut fds = [PollFd::new(&data_socket, PollFlags::OUT)]; in server() variables 54 assert_eq!(poll(&mut fds, -1).unwrap(), 1); in server() 55 assert!(!fds[0].revents().intersects(PollFlags::IN)); in server() 56 assert!(fds[0].revents().intersects(PollFlags::OUT)); in server() 82 let mut fds = [PollFd::new(&data_socket, PollFlags::OUT)]; in client() variables 83 assert_eq!(poll(&mut fds, in client() 89 let mut fds = [PollFd::new(&data_socket, PollFlags::IN)]; client() variables [all...] |
/third_party/ffmpeg/libavformat/ |
H A D | os_support.c | 226 int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout) in ff_poll() argument 248 if (fds[i].fd < 0) in ff_poll() 251 if (fds[i].fd >= FD_SETSIZE) { in ff_poll() 257 if (fds[i].events & POLLIN) in ff_poll() 258 FD_SET(fds[i].fd, &read_set); in ff_poll() 259 if (fds[i].events & POLLOUT) in ff_poll() 260 FD_SET(fds[i].fd, &write_set); in ff_poll() 261 if (fds[i].events & POLLERR) in ff_poll() 262 FD_SET(fds[i].fd, &exception_set); in ff_poll() 264 if (fds[ in ff_poll() [all...] |
/third_party/ltp/testcases/kernel/syscalls/socketpair/ |
H A D | socketpair01.c | 22 static int fds[2]; variable 33 {0, SOCK_STREAM, 0, fds, -1, EAFNOSUPPORT, "invalid domain"}, 34 {PF_INET, 75, 0, fds, -1, EINVAL, "invalid type"}, 35 {PF_UNIX, SOCK_DGRAM, 0, fds, 0, 0, "UNIX domain dgram"}, 36 {PF_INET, SOCK_RAW, 0, fds, -1, EPROTONOSUPPORT, "raw open as non-root"}, 41 {PF_INET, SOCK_DGRAM, 17, fds, -1, EOPNOTSUPP, "UDP socket"}, 42 {PF_INET, SOCK_DGRAM, 6, fds, -1, EPROTONOSUPPORT, "TCP dgram"}, 43 {PF_INET, SOCK_STREAM, 6, fds, -1, EOPNOTSUPP, "TCP socket"}, 44 {PF_INET, SOCK_STREAM, 1, fds, -1, EPROTONOSUPPORT, "ICMP stream"} 54 SAFE_CLOSE(fds[ in verify_socketpair() [all...] |
H A D | socketpair02.c | 25 static int fds[2]; variable 44 TEST(socketpair(PF_UNIX, tc->type, 0, fds)); in verify_socketpair() 50 res = SAFE_FCNTL(fds[i], tc->fl_flag); in verify_socketpair() 53 tst_res(TFAIL, "socketpair() failed to set %s flag for fds[%d]", in verify_socketpair() 59 tst_res(TFAIL, "socketpair() failed to set %s flag for fds[%d]", in verify_socketpair() 68 SAFE_CLOSE(fds[0]); in verify_socketpair() 69 SAFE_CLOSE(fds[1]); in verify_socketpair() 74 if (fds[0] > 0) in cleanup() 75 SAFE_CLOSE(fds[0]); in cleanup() 77 if (fds[ in cleanup() [all...] |
/third_party/ltp/testcases/kernel/syscalls/fstatat/ |
H A D | fstatat01.c | 56 static int fds[TEST_CASES]; variable 97 TEST(fstatat(fds[i], filenames[i], &statbuf, flags[i])); in main() 125 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup() 126 fds[1] = fds[4] = fds[0]; in setup() 131 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup() 133 fds[3] = 100; in setup() 134 fds[5] = AT_FDCWD; in setup() 145 if (fds[ in cleanup() [all...] |
/third_party/musl/libc-test/src/functionalext/supplement/fortify/fortify_gtest/ |
H A D | fortify_poll_chk_test.cpp | 25 struct pollfd fds[1]; in HWTEST_F() local 26 fds[0].fd = 0; in HWTEST_F() 27 fds[0].events = POLLIN; in HWTEST_F() 28 int ret = __poll_chk(fds, 0, 1, sizeof(fds)); in HWTEST_F() 39 struct pollfd fds[1]; in HWTEST_F() local 40 fds[0].fd = 1; in HWTEST_F() 41 fds[0].events = POLLIN; in HWTEST_F() 44 EXPECT_DEATH(__poll_chk(fds, nfds, TIME_OUT, fdsLen), ""); in HWTEST_F()
|
/third_party/ltp/testcases/kernel/syscalls/epoll_ctl/ |
H A D | epoll_ctl03.c | 23 static int epfd, fds[2]; variable 42 TST_EXP_PASS(epoll_ctl(epfd, EPOLL_CTL_MOD, fds[0], &events), in run_all() 54 SAFE_PIPE(fds); in setup() 55 events.data.fd = fds[0]; in setup() 57 if (epoll_ctl(epfd, EPOLL_CTL_ADD, fds[0], &events)) in setup() 66 if (fds[0]) in cleanup() 67 SAFE_CLOSE(fds[0]); in cleanup() 69 if (fds[1]) in cleanup() 70 SAFE_CLOSE(fds[1]); in cleanup()
|