Home
last modified time | relevance | path

Searched refs:fds (Results 1 – 25 of 367) sorted by relevance

12345678910>>...15

/third_party/node/test/wasi/c/
Dpoll.c9 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[1] = (struct pollfd){.fd = 2, .events = POLLOUT, .revents = 0}; in main()
[all …]
/third_party/glib/glib/tests/
Dgpoll.c40 GPollFD fds[], in prepare_fds() argument
47 fds[i].fd = (gintptr) WSACreateEvent (); in prepare_fds()
48 g_assert (WSAEventSelect (sockets[i], (HANDLE) fds[i].fd, FD_READ | FD_CLOSE) == 0); in prepare_fds()
53 reset_fds (GPollFD fds[], in reset_fds() argument
60 WSAResetEvent ((HANDLE) fds[i].fd); in reset_fds()
61 fds[i].events = G_IO_IN | G_IO_OUT | G_IO_ERR; in reset_fds()
62 fds[i].revents = 0; in reset_fds()
67 reset_fds_msg (GPollFD fds[], in reset_fds_msg() argument
70 fds[num_pollfds - 1].fd = G_WIN32_MSG_HANDLE; in reset_fds_msg()
71 fds[num_pollfds - 1].events = G_IO_IN; in reset_fds_msg()
[all …]
/third_party/musl/libc-test/src/functionalext/supplement/select/
Dpoll_sup.c35 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, 2, time_delay); in poll_0100()
70 if (fds[i].revents) { in poll_0100()
[all …]
/third_party/glib/gio/
Dgunixfdlist.c54 gint *fds; member
73 close (list->priv->fds[i]); in g_unix_fd_list_finalize()
74 g_free (list->priv->fds); in g_unix_fd_list_finalize()
179 g_unix_fd_list_new_from_array (const gint *fds, in g_unix_fd_list_new_from_array() argument
184 g_return_val_if_fail (fds != NULL || n_fds == 0, NULL); in g_unix_fd_list_new_from_array()
187 for (n_fds = 0; fds[n_fds] != -1; n_fds++); in g_unix_fd_list_new_from_array()
190 list->priv->fds = g_new (gint, n_fds + 1); in g_unix_fd_list_new_from_array()
194 memcpy (list->priv->fds, fds, sizeof (gint) * n_fds); in g_unix_fd_list_new_from_array()
195 list->priv->fds[n_fds] = -1; in g_unix_fd_list_new_from_array()
239 if (list->priv->fds == NULL) in g_unix_fd_list_steal_fds()
[all …]
/third_party/musl/porting/linux/user/include/fortify/
Dpoll.h34 int poll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, int timeout) in poll()
36 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amount), in poll()
40 size_t bos_fds = __DIAGNOSE_BOS(fds); in poll()
42 if (!__DIAGNOSE_BOS_FD_COUNT_TRIVIALLY_SAFE(bos_fds, fds, fd_amount)) { in poll()
43 return __poll_diagnose(fds, fd_amount, timeout, bos_fds); in poll()
46 return __DIAGNOSE_CALL_BYPASSING_FORTIFY(poll)(fds, fd_amount, timeout); in poll()
51 int ppoll(struct pollfd* const fds __DIAGNOSE_PASS_OBJECT_SIZE, nfds_t fd_amount, in ppoll()
54 __DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT(__DIAGNOSE_BOS(fds), sizeof(*fds) * fd_amount), in ppoll()
58 size_t bos_fds = __DIAGNOSE_BOS(fds); in ppoll()
60 if (!__DIAGNOSE_BOS_FD_COUNT_TRIVIALLY_SAFE(bos_fds, fds, fd_amount)) { in ppoll()
[all …]
/third_party/ltp/testcases/kernel/syscalls/epoll_wait/
Depoll_wait01.c22 static int write_size, epfd, fds[2]; variable
30 {.fd = fds[1], .events = POLLOUT}, in get_writesize()
36 write_size += SAFE_WRITE(0, 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[1]) { in verify_epollout()
[all …]
Depoll_wait02.c20 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()
Depoll_wait04.c20 static int epfd, fds[2]; variable
43 SAFE_PIPE(fds); in setup()
49 epevs[0].data.fd = fds[0]; in setup()
51 if (epoll_ctl(epfd, EPOLL_CTL_ADD, fds[0], &epevs[0])) in setup()
60 if (fds[0] > 0) in cleanup()
61 SAFE_CLOSE(fds[0]); in cleanup()
63 if (fds[1] > 0) in cleanup()
64 SAFE_CLOSE(fds[1]); in cleanup()
/third_party/glib/glib/
Dgwakeup.c121 gint fds[2]; member
146 wakeup->fds[0] = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK); in g_wakeup_new()
148 wakeup->fds[0] = -1; in g_wakeup_new()
151 if (wakeup->fds[0] != -1) in g_wakeup_new()
153 wakeup->fds[1] = -1; in g_wakeup_new()
160 if (!g_unix_open_pipe (wakeup->fds, FD_CLOEXEC, &error)) in g_wakeup_new()
163 if (!g_unix_set_fd_nonblocking (wakeup->fds[0], TRUE, &error) || in g_wakeup_new()
164 !g_unix_set_fd_nonblocking (wakeup->fds[1], TRUE, &error)) in g_wakeup_new()
186 poll_fd->fd = wakeup->fds[0]; in g_wakeup_get_pollfd()
210 while (read (wakeup->fds[0], buffer, sizeof buffer) == sizeof buffer); in g_wakeup_acknowledge()
[all …]
/third_party/ltp/testcases/kernel/syscalls/pipe2/
Dpipe2_04.c19 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(1, 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(1, fds[1], write_buffer, pipe_size); in setup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/pipe/
Dpipe12.c17 static int fds[2]; variable
47 SAFE_WRITE(1, fds[1], wrbuf, max_size); in verify_pipe()
48 TEST(write(fds[1], "x", 1)); in verify_pipe()
58 SAFE_WRITE(1, 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[1] > 0) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/fchmodat/
Dfchmodat01.c61 int fds[TEST_CASES]; variable
90 TEST(myfchmodat(fds[i], filenames[i], 0600)); in main()
127 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup()
128 fds[1] = fds[4] = fds[0]; in setup()
133 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup()
134 fds[3] = 100; in setup()
135 fds[5] = AT_FDCWD; in setup()
146 if (fds[0] > 0) in cleanup()
147 close(fds[0]); in cleanup()
148 if (fds[2] > 0) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/faccessat/
Dfaccessat01.c61 static int fds[TEST_CASES]; variable
90 TEST(myfaccessat(fds[i], filenames[i], R_OK)); in main()
129 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup()
130 fds[1] = fds[4] = fds[0]; in setup()
135 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup()
137 fds[3] = 100; in setup()
138 fds[5] = AT_FDCWD; in setup()
149 if (fds[0] > 0) in cleanup()
150 close(fds[0]); in cleanup()
151 if (fds[2] > 0) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/futimesat/
Dfutimesat01.c55 static int fds[TEST_CASES]; variable
82 TEST(myfutimesat(fds[i], filenames[i], times)); in main()
111 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup()
112 fds[1] = fds[0]; in setup()
117 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup()
119 fds[3] = 100; in setup()
120 fds[4] = AT_FDCWD; in setup()
130 if (fds[0] > 0) in cleanup()
131 close(fds[0]); in cleanup()
132 if (fds[2] > 0) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/fstatat/
Dfstatat01.c56 static int fds[TEST_CASES]; variable
100 TEST(fstatat(fds[i], filenames[i], &statbuf, flags[i])); in main()
128 fds[0] = SAFE_OPEN(cleanup, pathname, O_DIRECTORY); in setup()
129 fds[1] = fds[4] = fds[0]; in setup()
134 fds[2] = SAFE_OPEN(cleanup, testfile3, O_CREAT | O_RDWR, 0600); in setup()
136 fds[3] = 100; in setup()
137 fds[5] = AT_FDCWD; in setup()
148 if (fds[0] > 0) in cleanup()
149 close(fds[0]); in cleanup()
150 if (fds[2] > 0) in cleanup()
[all …]
/third_party/ltp/testcases/kernel/syscalls/socketpair/
Dsocketpair01.c22 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[0]); in verify_socketpair()
[all …]
Dsocketpair02.c25 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()
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[1] > 0) in cleanup()
78 SAFE_CLOSE(fds[1]); in cleanup()
/third_party/libwebsockets/lib/plat/freertos/
Dfreertos-service.c139 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[m].fd, &readfds)) { in _lws_plat_service_tsi()
159 pt->fds[m].revents |= LWS_POLLIN; in _lws_plat_service_tsi()
[all …]
/third_party/ffmpeg/libavformat/
Dos_support.c226 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[i].fd >= n) in ff_poll()
[all …]
/third_party/ltp/testcases/kernel/syscalls/epoll_ctl/
Depoll_ctl03.c23 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()
/third_party/e2fsprogs/lib/
Dfpopen.c43 int fds[2]; in fpopen() local
93 if (pipe(fds) < 0) in fpopen()
102 close(fds[1]); in fpopen()
103 dup2(fds[0], 0); in fpopen()
105 close(fds[0]); in fpopen()
106 dup2(fds[1], 1); in fpopen()
108 dup2(fds[1], 2); in fpopen()
114 return fdopen(do_stdin ? fds[1] : fds[0], mode); in fpopen()
/third_party/ltp/testcases/kernel/syscalls/fcntl/
Dfcntl37.c24 static int fds[2]; variable
43 TEST(fcntl(fds[1], F_SETPIPE_SZ, *(tc->setvalue))); in verify_fcntl()
60 SAFE_PIPE(fds); in setup()
62 TEST(fcntl(fds[1], F_GETPIPE_SZ)); in setup()
70 SAFE_WRITE(1, fds[1], wrbuf, orig_value); in setup()
82 if (fds[0] > 0) in cleanup()
83 SAFE_CLOSE(fds[0]); in cleanup()
84 if (fds[1] > 0) in cleanup()
85 SAFE_CLOSE(fds[1]); in cleanup()
/third_party/ltp/testcases/kernel/syscalls/ppoll/
Dppoll01.c44 struct pollfd *fds; /* fds ppoll parameter */ member
88 .fds = fds_good,
97 .fds = fds_good,
107 .fds = fds_good,
116 .fds = fds_already_closed,
124 .fds = fds_good,
136 .fds = fds_good,
146 .fds = fds_good,
154 .fds = (struct pollfd *) -1,
158 static inline int libc_ppoll(struct pollfd *fds, nfds_t nfds, void *tmo_p, in libc_ppoll() argument
[all …]
/third_party/libusb/libusb/os/
Devents_posix.c192 struct pollfd *fds; in usbi_alloc_event_data() local
204 fds = calloc(ctx->event_data_cnt, sizeof(*fds)); in usbi_alloc_event_data()
205 if (!fds) in usbi_alloc_event_data()
209 fds[i].fd = ievent_source->data.os_handle; in usbi_alloc_event_data()
210 fds[i].events = ievent_source->data.poll_events; in usbi_alloc_event_data()
214 ctx->event_data = fds; in usbi_alloc_event_data()
221 struct pollfd *fds = ctx->event_data; in usbi_wait_for_events() local
226 num_ready = poll(fds, nfds, timeout_ms); in usbi_wait_for_events()
240 if (fds[0].revents) { in usbi_wait_for_events()
249 if (usbi_using_timer(ctx) && fds[1].revents) { in usbi_wait_for_events()
[all …]
/third_party/ltp/testcases/kernel/syscalls/poll/
Dpoll02.c16 static int fds[2]; variable
23 {.fd = fds[0], .events = POLLIN} in sample_fn()
41 SAFE_PIPE(fds); in setup()
46 if (fds[0] > 0) in cleanup()
47 SAFE_CLOSE(fds[0]); in cleanup()
49 if (fds[1] > 0) in cleanup()
50 SAFE_CLOSE(fds[1]); in cleanup()

12345678910>>...15