| /netbsd-src/lib/libc/rpc/ |
| H A D | svc_fdset.c | 90 svc_fdset_print(const char *func, size_t line, struct svc_fdset *fds, in svc_fdset_print() argument 100 fprintf(stderr, "%p[%d] fd_set<", fds->fdset, fds->fdmax); in svc_fdset_print() 101 for (int i = 0; i <= fds->fdmax; i++) { in svc_fdset_print() 102 if (!FD_ISSET(i, fds->fdset)) in svc_fdset_print() 109 for (int i = 0; i < fds->fdused; i++) { in svc_fdset_print() 110 int fd = fds->fdp[i].fd; in svc_fdset_print() 142 svc_fdset_sanitize(struct svc_fdset *fds) in svc_fdset_sanitize() argument 144 while (fds->fdmax >= 0 && !FD_ISSET(fds->fdmax, fds->fdset)) in svc_fdset_sanitize() 145 fds->fdmax--; in svc_fdset_sanitize() 148 if (fds == &__svc_fdset) { in svc_fdset_sanitize() [all …]
|
| /netbsd-src/tests/lib/libc/sys/ |
| H A D | msg.h | 45 msg_open(struct msg_fds *fds) in msg_open() argument 47 if (pipe(fds->pfd) == -1) in msg_open() 49 if (pipe(fds->cfd) == -1) { in msg_open() 50 close(fds->pfd[0]); in msg_open() 51 close(fds->pfd[1]); in msg_open() 58 msg_close(struct msg_fds *fds) in msg_close() argument 60 CLOSEFD(fds->pfd[0]); in msg_close() 61 CLOSEFD(fds->pfd[1]); in msg_close() 62 CLOSEFD(fds->cfd[0]); in msg_close() 63 CLOSEFD(fds->cfd[1]); in msg_close() [all …]
|
| H A D | t_eventfd.c | 273 struct pollfd fds[1]; in ATF_TC_BODY() local 290 fds[0].fd = efd; in ATF_TC_BODY() 291 fds[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | in ATF_TC_BODY() 293 fds[0].revents = 0; in ATF_TC_BODY() 294 ATF_REQUIRE(poll(fds, 1, 0) == 1); in ATF_TC_BODY() 295 ATF_REQUIRE(fds[0].revents == (POLLOUT | POLLWRNORM)); in ATF_TC_BODY() 331 fds[0].fd = efd; in ATF_TC_BODY() 332 fds[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | in ATF_TC_BODY() 334 fds[0].revents = 0; in ATF_TC_BODY() 335 ATF_REQUIRE(poll(fds, 1, 0) == 1); in ATF_TC_BODY() [all …]
|
| H A D | t_timerfd.c | 173 "validates rejection of bogus fds by timerfd_{get,set}time()"); 510 struct pollfd fds[1]; in ATF_TC_BODY() 529 fds[0].fd = fd; in ATF_TC_BODY() 530 fds[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | in ATF_TC_BODY() 532 fds[0].revents = 0; in ATF_TC_BODY() 533 ATF_REQUIRE(poll(fds, 1, 0) == 0); in ATF_TC_BODY() 566 fds[0].fd = fd; in timerfd_restart_helper() 567 fds[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | in timerfd_restart_helper() 569 fds[0].revents = 0; in timerfd_restart_helper() 570 ATF_REQUIRE(poll(fds, in timerfd_restart_helper() 380 struct pollfd fds[1]; ATF_TC_BODY() local 493 struct pollfd fds[1]; ATF_TC_BODY() local [all...] |
| /netbsd-src/crypto/external/bsd/heimdal/dist/lib/roken/ |
| H A D | mini_inetd.c | 96 rk_socket_t *fds; in mini_inetd_addrinfo() local 103 fds = malloc (nalloc * sizeof(*fds)); in mini_inetd_addrinfo() 104 if (fds == NULL) { in mini_inetd_addrinfo() 112 fds[i] = socket (a->ai_family, a->ai_socktype, a->ai_protocol); in mini_inetd_addrinfo() 113 if (rk_IS_BAD_SOCKET(fds[i])) in mini_inetd_addrinfo() 115 socket_set_reuseaddr (fds[i], 1); in mini_inetd_addrinfo() 116 socket_set_ipv6only(fds[i], 1); in mini_inetd_addrinfo() 117 if (rk_IS_SOCKET_ERROR(bind (fds[i], a->ai_addr, a->ai_addrlen))) { in mini_inetd_addrinfo() 119 rk_closesocket(fds[i]); in mini_inetd_addrinfo() 120 fds[i] = rk_INVALID_SOCKET; in mini_inetd_addrinfo() [all …]
|
| /netbsd-src/tests/kernel/kqueue/write/ |
| H A D | t_pipe.c | 59 int fds[2]; in ATF_TC_BODY() local 62 RL(pipe(fds)); in ATF_TC_BODY() 64 RL(close(fds[0])); in ATF_TC_BODY() 66 EV_SET(&event[0], fds[1], EVFILT_WRITE, EV_ADD|EV_ENABLE, 0, 0, 0); in ATF_TC_BODY() 83 int fds[2]; in ATF_TC_BODY() local 88 RL(pipe(fds)); in ATF_TC_BODY() 91 EV_SET(&event[0], fds[1], EVFILT_WRITE, EV_ADD|EV_ENABLE, 0, 0, 0); in ATF_TC_BODY() 97 int sz = read(fds[0], buffer, 128); in ATF_TC_BODY() 108 RL(n = write(fds[1], "foo", 3)); in ATF_TC_BODY() 109 RL(close(fds[1])); in ATF_TC_BODY() [all …]
|
| /netbsd-src/usr.bin/rsh/ |
| H A D | rsh.c | 339 struct pollfd fds[3], *fdp = &fds[0]; in talk() local 395 fdp = &fds[1]; in talk() 397 fds[0].events = 0; in talk() 400 fdp = &fds[0]; in talk() 402 fds[0].events = POLLIN|POLLNVAL|POLLERR|POLLHUP; in talk() 403 fds[0].fd = 2; in talk() 407 fds[1].events = fds[2].events = POLLIN|POLLNVAL|POLLERR|POLLHUP; in talk() 408 fds[1].fd = remerr; in talk() 409 fds[2].fd = rem; in talk() 416 if ((fds[1].events != 0 && checkfd(&fds[1], 2) == -1) in talk() [all …]
|
| /netbsd-src/sys/external/bsd/libnv/dist/ |
| H A D | msgio.c | 122 fd_set fds; in fd_wait() local 126 FD_ZERO(&fds); in fd_wait() 127 FD_SET(fd, &fds); in fd_wait() 128 (void)select(fd + 1, doread ? &fds : NULL, doread ? NULL : &fds, in fd_wait() 256 fd_package_send(int sock, const int *fds, size_t nfds) in fd_package_send() argument 266 PJDLOG_ASSERT(fds != NULL); in fd_package_send() 289 if (msghdr_add_fd(cmsg, fds[i]) == -1) in fd_package_send() 305 fd_package_recv(int sock, int *fds, size_t nfds) in fd_package_recv() argument 316 PJDLOG_ASSERT(fds != NULL); in fd_package_recv() 341 fds[i] = msghdr_get_fd(cmsg); in fd_package_recv() [all …]
|
| /netbsd-src/crypto/external/bsd/openssl.old/dist/crypto/async/ |
| H A D | async_wait.c | 28 curr = ctx->fds; in ASYNC_WAIT_CTX_free() 60 fdlookup->next = ctx->fds; in ASYNC_WAIT_CTX_set_wait_fd() 61 ctx->fds = fdlookup; in ASYNC_WAIT_CTX_set_wait_fd() 71 curr = ctx->fds; in ASYNC_WAIT_CTX_get_fd() 93 curr = ctx->fds; in ASYNC_WAIT_CTX_get_all_fds() 122 curr = ctx->fds; in ASYNC_WAIT_CTX_get_changed_fds() 144 curr = ctx->fds; in ASYNC_WAIT_CTX_clear_fd() 156 if (ctx->fds == curr) { in ASYNC_WAIT_CTX_clear_fd() 157 ctx->fds = curr->next; in ASYNC_WAIT_CTX_clear_fd() 192 curr = ctx->fds; in async_wait_ctx_reset_counts() [all …]
|
| /netbsd-src/games/sail/ |
| H A D | dr_main.c | 135 int fds[2]; in startdriver() local 138 if (pipe(fds)) { in startdriver() 146 close(fds[0]); in startdriver() 147 driver_wait_fd = fds[1]; in startdriver() 152 close(fds[0]); in startdriver() 153 close(fds[1]); in startdriver() 158 close(fds[1]); in startdriver() 159 read(fds[0], &c, 1); in startdriver() 160 close(fds[0]); in startdriver()
|
| /netbsd-src/crypto/external/bsd/openssl/dist/crypto/async/ |
| H A D | async_wait.c | 28 curr = ctx->fds; in ASYNC_WAIT_CTX_free() 60 fdlookup->next = ctx->fds; in ASYNC_WAIT_CTX_set_wait_fd() 61 ctx->fds = fdlookup; in ASYNC_WAIT_CTX_set_wait_fd() 71 curr = ctx->fds; in ASYNC_WAIT_CTX_get_fd() 93 curr = ctx->fds; in ASYNC_WAIT_CTX_get_all_fds() 122 curr = ctx->fds; in ASYNC_WAIT_CTX_get_changed_fds() 144 curr = ctx->fds; in ASYNC_WAIT_CTX_clear_fd() 156 if (ctx->fds == curr) { in ASYNC_WAIT_CTX_clear_fd() 157 ctx->fds = curr->next; in ASYNC_WAIT_CTX_clear_fd() 227 curr = ctx->fds; in async_wait_ctx_reset_counts() [all …]
|
| /netbsd-src/sys/kern/ |
| H A D | sys_select.c | 236 sel_do_scan(const char *opname, void *fds, const int nf, const size_t ni, in sel_do_scan() argument 264 l->l_selbits = fds; in sel_do_scan() 293 error = selscan((char *)fds, nf, ni, retval); in sel_do_scan() 295 error = pollscan((struct pollfd *)fds, nf, retval); in sel_do_scan() 395 * Don't allow absurdly large numbers of fds to be selected. in selcommon() 400 * include all the possible fds, as fd_sets are always in selcommon() 404 * set lower after some fds were opened, we always allow selecting 433 nd -= fb * NFDBITS; /* the number of excess fds */ in selscan() 435 #define checkbits(name, o, sz, fds) \ in selscan() 442 if (anyset(bits, (fds) in selscan() 525 struct pollfd *fds; pollcommon() local 574 pollscan(struct pollfd * fds,const int nfd,register_t * retval) pollscan() argument 724 fd_mask *fds = (fd_mask *)l->l_selbits; sel_setevents() local [all...] |
| /netbsd-src/libexec/httpd/ |
| H A D | daemon-bozo.c | 152 httpd->fds = bozomalloc(httpd, httpd->nsock * sizeof(*httpd->fds)); in bozo_daemon_init() 165 httpd->fds[i].events = POLLIN | POLLPRI | POLLRDNORM | in bozo_daemon_init() 167 httpd->fds[i].fd = httpd->sock[i]; in bozo_daemon_init() 214 if ((httpd->fds[idx].revents & (POLLNVAL|POLLERR|POLLHUP)) == 0) in daemon_poll_err() 218 httpd->fds[idx].fd, getpid(), httpd->fds[idx].revents, in daemon_poll_err() 229 memmove(&httpd->fds[idx], &httpd->fds[idx+1], in daemon_poll_err() 230 (httpd->nsock - idx) * sizeof(*httpd->fds)); in daemon_poll_err() 275 if (poll(httpd->fds, (unsigned)httpd->nsock, INFTIM) == -1) { in bozo_daemon_fork() 293 if (httpd->fds[i].revents == 0) in bozo_daemon_fork() 297 fd = accept(httpd->fds[i].fd, in bozo_daemon_fork()
|
| /netbsd-src/external/bsd/mdocml/dist/ |
| H A D | mandocd.c | 58 read_fds(int clientfd, int *fds) in read_fds() argument 111 fds[cnt] = *walk++; in read_fds() 128 int fds[3]; in main() local 201 while (state == 1 && (state = read_fds(clientfd, fds)) == 1) { in main() 202 if (dup2(fds[0], STDIN_FILENO) == -1 || in main() 203 dup2(fds[1], STDOUT_FILENO) == -1 || in main() 204 dup2(fds[2], STDERR_FILENO) == -1) { in main() 210 close(fds[0]); in main() 211 close(fds[1]); in main() 212 close(fds[2]); in main()
|
| /netbsd-src/crypto/external/bsd/heimdal/dist/lib/kadm5/ |
| H A D | ipropd_common.c | 112 int fds[2]; in restarter() local 117 fds[0] = -1; in restarter() 118 fds[1] = -1; in restarter() 126 if (fds[1] != -1) in restarter() 127 (void) close(fds[1]); in restarter() 132 if (pipe(fds) == -1) { in restarter() 152 (void) close(fds[1]); in restarter() 154 return fds[0]; in restarter() 159 (void) close(fds[0]); in restarter()
|
| /netbsd-src/sys/modules/examples/pollpal/ |
| H A D | cmd_pollpal.c | 76 struct pollfd fds; in main() local 87 fds.fd = fd; in main() 88 fds.events = POLLOUT|POLLIN; in main() 92 ret = poll(&fds, 1, TIMEOUT); in main() 105 if (fds.revents & (POLLERR | POLLHUP | POLLNVAL)) in main() 108 if (fds.revents & POLLOUT) { in main() 118 if (fds.revents & POLLIN) { in main()
|
| /netbsd-src/external/bsd/nsd/dist/ |
| H A D | netio.c | 111 static struct pollfd fds[MAX_NETIO_FDS]; in netio_dispatch() local 147 fds[numfd].fd = handler->fd; in netio_dispatch() 148 fds[numfd].events = 0; in netio_dispatch() 149 fds[numfd].revents = 0; in netio_dispatch() 152 fds[numfd].events |= POLLIN; in netio_dispatch() 155 fds[numfd].events |= POLLOUT; in netio_dispatch() 193 rc = ppoll(fds, numfd, (have_timeout?&minimum_timeout:NULL), sigmask); in netio_dispatch() 196 rc = poll(fds, numfd, (have_timeout?minimum_timeout.tv_sec*1000+ in netio_dispatch() 238 if ((fds[handler->pfd].revents & POLLIN)) { in netio_dispatch() 241 if ((fds[handler->pfd].revents & POLLOUT)) { in netio_dispatch() [all …]
|
| H A D | popen3.c | 13 static void close_pipe(int fds[2]) in close_pipe() 15 if(fds[0] != -1) { in close_pipe() 16 close(fds[0]); in close_pipe() 17 fds[0] = -1; in close_pipe() 19 if(fds[1] != -1) { in close_pipe() 20 close(fds[1]); in close_pipe() 21 fds[1] = -1; in close_pipe()
|
| /netbsd-src/regress/sys/kern/dislodgefd/ |
| H A D | dislodgefd.c | 40 int fds[2]; variable 49 if (read(fds[0], buf, sizeof(buf)) == -1) in reader() 62 if (pipe(fds)) in main() 65 if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) in main() 75 close(fds[0]); in main()
|
| /netbsd-src/libexec/rexecd/ |
| H A D | rexecd.c | 146 struct pollfd fds[2]; local 283 fds[0].fd = s; 284 fds[1].fd = pv[0]; 285 fds[0].events = fds[1].events = POLLIN; 290 if (poll(fds, 2, 0) < 0) { 295 if (fds[0].revents & POLLIN) { 297 fds[0].events = 0; 301 if (fds[1].revents & POLLIN) { 305 fds[1].events = 0; 309 } while ((fds[0].events | fds[1].events) & POLLIN);
|
| /netbsd-src/external/mit/libuv/dist/test/ |
| H A D | test-ping-pong.c | 306 uv_os_sock_t fds[2]; in socketpair_pinger_new() local 318 ASSERT_EQ(0, uv_socketpair(SOCK_STREAM, 0, fds, UV_NONBLOCK_PIPE, UV_NONBLOCK_PIPE)); in socketpair_pinger_new() 321 ASSERT_EQ(uv_guess_handle((uv_file) fds[0]), UV_NAMED_PIPE); in socketpair_pinger_new() 322 ASSERT_EQ(uv_guess_handle((uv_file) fds[1]), UV_NAMED_PIPE); in socketpair_pinger_new() 327 ASSERT_EQ(0, uv_tcp_open(&pinger->stream.tcp, fds[1])); in socketpair_pinger_new() 333 ASSERT_EQ(0, uv_tcp_open(ponger, fds[0])); in socketpair_pinger_new() 347 uv_file fds[2]; in pipe2_pinger_new() local 352 ASSERT_EQ(0, uv_pipe(fds, UV_NONBLOCK_PIPE, UV_NONBLOCK_PIPE)); in pipe2_pinger_new() 353 ASSERT_EQ(uv_guess_handle(fds[0]), UV_NAMED_PIPE); in pipe2_pinger_new() 354 ASSERT_EQ(uv_guess_handle(fds[1]), UV_NAMED_PIPE); in pipe2_pinger_new() [all …]
|
| /netbsd-src/external/gpl3/gdb.old/dist/readline/readline/examples/ |
| H A D | rl-callbacktest.c | 72 fd_set fds; in main() local 91 FD_ZERO (&fds); in main() 92 FD_SET (fileno (rl_instream), &fds); in main() 94 r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); in main() 109 if (FD_ISSET (fileno (rl_instream), &fds)) in main()
|
| /netbsd-src/tests/kernel/kqueue/read/ |
| H A D | t_pipe.c | 55 int fds[2]; in ATF_TC_BODY() local 58 RL(pipe(fds)); in ATF_TC_BODY() 61 EV_SET(&event[0], fds[0], EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0); in ATF_TC_BODY() 65 RL(write(fds[1], "foo", 3)); in ATF_TC_BODY() 72 RL(n = read(fds[0], buffer, event[0].data)); in ATF_TC_BODY()
|
| /netbsd-src/external/gpl3/gdb/dist/readline/readline/examples/ |
| H A D | rl-callbacktest.c | 72 fd_set fds; in main() local 91 FD_ZERO (&fds); in main() 92 FD_SET (fileno (rl_instream), &fds); in main() 94 r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); in main() 109 if (FD_ISSET (fileno (rl_instream), &fds)) in main()
|
| /netbsd-src/external/bsd/kyua-cli/dist/utils/process/ |
| H A D | child.cpp | 261 int fds[2]; in fork_capture_aux() local 262 if (detail::syscall_pipe(fds) == -1) in fork_capture_aux() 270 ::close(fds[0]); in fork_capture_aux() 271 ::close(fds[1]); in fork_capture_aux() 278 ::close(fds[0]); in fork_capture_aux() 279 safe_dup(fds[1], STDOUT_FILENO); in fork_capture_aux() 280 safe_dup(fds[1], STDERR_FILENO); in fork_capture_aux() 281 ::close(fds[1]); in fork_capture_aux() 288 ::close(fds[1]); in fork_capture_aux() 293 new process::child(new impl(pid, new process::ifdstream(fds[0])))); in fork_capture_aux()
|