/kernel/linux/linux-5.10/tools/testing/selftests/net/ |
D | psock_fanout.c | 221 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument 225 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read() 226 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read() 255 int fds[2]; in test_control_group() local 259 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 260 if (fds[0] == -1) { in test_control_group() 278 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 279 if (fds[1] == -1) { in test_control_group() 283 if (close(fds[1]) || close(fds[0])) { in test_control_group() 292 int fds[3]; in test_unique_fanout_group_ids() local [all …]
|
D | psock_lib.h | 75 static __maybe_unused void pair_udp_open(int fds[], uint16_t port) in pair_udp_open() argument 79 fds[0] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open() 80 fds[1] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open() 81 if (fds[0] == -1 || fds[1] == -1) { in pair_udp_open() 97 if (bind(fds[1], (void *) &daddr, sizeof(daddr))) { in pair_udp_open() 101 if (bind(fds[0], (void *) &saddr, sizeof(saddr))) { in pair_udp_open() 105 if (connect(fds[0], (void *) &daddr, sizeof(daddr))) { in pair_udp_open() 111 static __maybe_unused void pair_udp_send_char(int fds[], int num, char payload) in pair_udp_send_char() argument 118 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) { in pair_udp_send_char() 122 if (read(fds[1], rbuf, sizeof(rbuf)) != sizeof(rbuf)) { in pair_udp_send_char() [all …]
|
/kernel/linux/linux-5.10/tools/bpf/bpftool/ |
D | common.c | 654 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument 695 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag() 700 *fds = tmp; in prog_fd_by_nametag() 702 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag() 709 close((*fds)[nb_fds]); in prog_fd_by_nametag() 713 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument 728 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds() 729 if ((*fds)[0] < 0) { in prog_parse_fds() 747 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds() 760 return prog_fd_by_nametag(name, fds, false); in prog_parse_fds() [all …]
|
D | map.c | 648 int *fds = NULL; in do_show_subset() local 652 fds = malloc(sizeof(int)); in do_show_subset() 653 if (!fds) { in do_show_subset() 657 nb_fds = map_parse_fds(&argc, &argv, &fds); in do_show_subset() 664 err = bpf_obj_get_info_by_fd(fds[i], &info, &len); in do_show_subset() 669 close(fds[i]); in do_show_subset() 674 show_map_close_json(fds[i], &info); in do_show_subset() 676 show_map_close_plain(fds[i], &info); in do_show_subset() 678 close(fds[i]); in do_show_subset() 684 free(fds); in do_show_subset() [all …]
|
/kernel/linux/linux-5.10/fs/ |
D | select.c | 413 #define FDS_IN(fds, n) (fds->in + n) argument 414 #define FDS_OUT(fds, n) (fds->out + n) argument 415 #define FDS_EX(fds, n) (fds->ex + n) argument 417 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n)) argument 419 static int max_select_fd(unsigned long n, fd_set_bits *fds) in max_select_fd() argument 433 set &= BITS(fds, n); in max_select_fd() 443 set = BITS(fds, n); in max_select_fd() 478 static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) in do_select() argument 489 retval = max_select_fd(n, fds); in do_select() 511 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select() [all …]
|
/kernel/linux/linux-5.10/arch/um/os-Linux/ |
D | helper.c | 46 int pid, fds[2], ret, n; in run_helper() local 52 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); in run_helper() 60 ret = os_set_exec_close(fds[1]); in run_helper() 71 data.fd = fds[1]; in run_helper() 82 close(fds[1]); in run_helper() 83 fds[1] = -1; in run_helper() 89 n = read(fds[0], &ret, sizeof(ret)); in run_helper() 105 if (fds[1] != -1) in run_helper() 106 close(fds[1]); in run_helper() 107 close(fds[0]); in run_helper()
|
D | sigio.c | 53 struct pollfds *fds, tmp; in write_sigio_thread() local 59 fds = ¤t_poll; in write_sigio_thread() 61 n = poll(fds->poll, fds->used, -1); in write_sigio_thread() 68 for (i = 0; i < fds->used; i++) { in write_sigio_thread() 69 p = &fds->poll[i]; in write_sigio_thread() 87 fds->used--; in write_sigio_thread() 88 memmove(&fds->poll[i], &fds->poll[i + 1], in write_sigio_thread() 89 (fds->used - i) * sizeof(*fds->poll)); in write_sigio_thread()
|
D | file.c | 375 int os_pipe(int *fds, int stream, int close_on_exec) in os_pipe() argument 379 err = socketpair(AF_UNIX, type, 0, fds); in os_pipe() 386 err = os_set_exec_close(fds[0]); in os_pipe() 390 err = os_set_exec_close(fds[1]); in os_pipe() 399 close(fds[1]); in os_pipe() 400 close(fds[0]); in os_pipe() 637 int os_sendmsg_fds(int fd, const void *buf, unsigned int len, const int *fds, in os_sendmsg_fds() argument 645 char control[CMSG_SPACE(sizeof(*fds) * OS_SENDMSG_MAX_FDS)]; in os_sendmsg_fds() 648 unsigned int fds_size = sizeof(*fds) * fds_num; in os_sendmsg_fds() 664 memcpy(CMSG_DATA(cmsg), fds, fds_size); in os_sendmsg_fds() [all …]
|
/kernel/linux/linux-5.10/arch/um/drivers/ |
D | ubd_user.c | 30 int pid, fds[2], err; in start_io_thread() local 32 err = os_pipe(fds, 1, 1); in start_io_thread() 38 kernel_fd = fds[0]; in start_io_thread() 41 *fd_out = fds[1]; in start_io_thread() 60 os_close_file(fds[0]); in start_io_thread() 61 os_close_file(fds[1]); in start_io_thread()
|
D | slirp_user.c | 52 int fds[2], pid, err; in slirp_open() local 54 err = os_pipe(fds, 1, 1); in slirp_open() 58 err = slirp_tramp(pri->argw.argv, fds[1]); in slirp_open() 65 pri->slave = fds[1]; in slirp_open() 70 return fds[0]; in slirp_open() 72 close(fds[0]); in slirp_open() 73 close(fds[1]); in slirp_open()
|
D | slip_user.c | 78 int pid, fds[2], err, output_len; in slip_tramp() local 80 err = os_pipe(fds, 1, 0); in slip_tramp() 89 pe_data.stdout_fd = fds[1]; in slip_tramp() 90 pe_data.close_me = fds[0]; in slip_tramp() 106 close(fds[1]); in slip_tramp() 107 read_output(fds[0], output, output_len); in slip_tramp() 111 close(fds[0]); in slip_tramp() 117 close(fds[0]); in slip_tramp() 118 close(fds[1]); in slip_tramp()
|
D | net_user.c | 182 int pid, fds[2], err; in change_tramp() local 185 err = os_pipe(fds, 1, 0); in change_tramp() 191 pe_data.close_me = fds[0]; in change_tramp() 192 pe_data.stdout_fd = fds[1]; in change_tramp() 196 read_output(fds[0], output, output_len); in change_tramp() 198 close(fds[0]); in change_tramp() 199 close(fds[1]); in change_tramp()
|
D | chan_user.c | 223 int fds[2], n, err, pid; in winch_tramp() local 226 err = os_pipe(fds, 1, 1); in winch_tramp() 234 .pipe_fd = fds[1] } ); in winch_tramp() 249 *fd_out = fds[0]; in winch_tramp() 250 n = read(fds[0], &c, sizeof(c)); in winch_tramp() 270 close(fds[1]); in winch_tramp() 271 close(fds[0]); in winch_tramp()
|
D | vector_kern.c | 362 mmsg_vector->msg_hdr.msg_name = vp->fds->remote_addr; in vector_enqueue() 363 mmsg_vector->msg_hdr.msg_namelen = vp->fds->remote_addr_size; in vector_enqueue() 430 vp->fds->tx_fd, in vector_send() 808 if (vp->fds != NULL) in vector_remove() 875 pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); in vector_legacy_rx() 928 vp->fds->tx_fd, in writev_tx() 978 vp->fds->rx_fd, qi->mmsg_vector, qi->max_depth, 0); in vector_mmsg_rx() 1072 deactivate_fd(vp->fds->rx_fd, vp->rx_irq); in vector_net_start_xmit() 1073 if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) in vector_net_start_xmit() 1074 deactivate_fd(vp->fds->tx_fd, vp->tx_irq); in vector_net_start_xmit() [all …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/pidfd/ |
D | pidfd_poll_test.c | 28 struct pollfd fds; in main() local 32 fds.events = POLLIN; in main() 85 fds.fd = pidfd; in main() 86 nevents = poll(&fds, 1, -1); in main() 97 if (!(fds.revents & POLLIN)) in main() 100 fds.revents); in main()
|
/kernel/linux/linux-5.10/tools/testing/vsock/ |
D | vsock_test.c | 207 int fds[MULTICONN_NFDS]; in test_stream_multiconn_client() local 211 fds[i] = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_multiconn_client() 212 if (fds[i] < 0) { in test_stream_multiconn_client() 220 recv_byte(fds[i], 1, 0); in test_stream_multiconn_client() 222 send_byte(fds[i], 1, 0); in test_stream_multiconn_client() 226 close(fds[i]); in test_stream_multiconn_client() 231 int fds[MULTICONN_NFDS]; in test_stream_multiconn_server() local 235 fds[i] = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_multiconn_server() 236 if (fds[i] < 0) { in test_stream_multiconn_server() 244 send_byte(fds[i], 1, 0); in test_stream_multiconn_server() [all …]
|
/kernel/liteos_a/testsuites/unittest/libc/io/full/ |
D | It_stdlib_poll_002.cpp | 42 struct pollfd fds[LISTEN_FD_NUM] = {0}; in Pthread01() local 47 fds[i].fd = g_pipeFd[i][0]; in Pthread01() 48 fds[i].events = pollEvents; in Pthread01() 52 ret = poll(fds, LISTEN_FD_NUM, 1000); // 1000, wait time. in Pthread01() 60 if (fds[i].revents & pollEvents) { in Pthread01() 61 ret = read(fds[i].fd, buffer, 12); // 12, "hello world" length and '\0' in Pthread01()
|
/kernel/linux/linux-5.10/samples/nitro_enclaves/ |
D | ne_ioctl_sample.c | 200 struct pollfd fds[1] = {}; in ne_poll_enclave_fd() local 206 fds[0].fd = enclave_fd; in ne_poll_enclave_fd() 207 fds[0].events = POLLIN | POLLERR | POLLHUP; in ne_poll_enclave_fd() 213 rc = poll(fds, 1, NE_POLL_WAIT_TIME_MS); in ne_poll_enclave_fd() 229 printf("Poll received value 0x%x\n", fds[0].revents); in ne_poll_enclave_fd() 231 if (fds[0].revents & POLLHUP) { in ne_poll_enclave_fd() 237 if (fds[0].revents & POLLNVAL) { in ne_poll_enclave_fd() 657 struct pollfd fds[1] = {}; in ne_start_enclave_check_booted() local 697 fds[0].fd = server_vsock_fd; in ne_start_enclave_check_booted() 698 fds[0].events = POLLIN; in ne_start_enclave_check_booted() [all …]
|
/kernel/liteos_a/testsuites/unittest/net/socket/smoke/ |
D | net_socket_test_009.cpp | 54 static void GetReadfds(struct pollfd *fds, int *nfd) in GetReadfds() argument 60 fds[*nfd].fd = gFds[i]; in GetReadfds() 61 fds[*nfd].events = POLLIN; in GetReadfds() 138 static int HandleReadfds(struct pollfd *fds, int nfds, int lsfd) in HandleReadfds() argument 142 if (fds[i].revents == 0) { in HandleReadfds() 145 LogPrintln("[%d]revents: %04hx", fds[i].fd, fds[i].revents); in HandleReadfds() 146 if (fds[i].fd == lsfd) { in HandleReadfds() 149 ret += HandleRecv(fds[i].fd); in HandleReadfds()
|
/kernel/linux/linux-5.10/tools/perf/bench/ |
D | sched-messaging.c | 53 static void fdpair(int fds[2]) in fdpair() 56 if (pipe(fds) == 0) in fdpair() 59 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0) in fdpair() 205 int fds[2]; in group() local 213 fdpair(fds); in group() 216 ctx->in_fds[0] = fds[0]; in group() 217 ctx->in_fds[1] = fds[1]; in group() 223 snd_ctx->out_fds[i] = fds[1]; in group() 225 close(fds[0]); in group()
|
/kernel/liteos_m/kal/posix/src/ |
D | poll.c | 91 STATIC INT32 QueryFds(struct pollfd *fds, nfds_t nfds, struct PollTable *table) in QueryFds() argument 97 if (((nfds != 0) && (fds == NULL)) || (table == NULL)) { in QueryFds() 103 struct pollfd *tmpFds = &fds[i]; in QueryFds() 157 STATIC INLINE INT32 PollTimedWait(struct pollfd *fds, nfds_t nfds, struct PollTable *table, INT32 t… in PollTimedWait() argument 194 count = QueryFds(fds, nfds, table); in PollTimedWait() 200 int poll(struct pollfd *fds, nfds_t nfds, int timeout) in poll() argument 212 count = QueryFds(fds, nfds, &table); in poll() 223 count = PollTimedWait(fds, nfds, &table, timeout); in poll()
|
/kernel/linux/linux-5.10/tools/perf/tests/ |
D | bpf.c | 44 int fds[2], i; in llseek_loop() local 46 fds[0] = open("/dev/null", O_RDONLY); in llseek_loop() 47 fds[1] = open("/dev/null", O_RDWR); in llseek_loop() 49 if (fds[0] < 0 || fds[1] < 0) in llseek_loop() 53 lseek(fds[i % 2], i, (i / 2) % 2 ? SEEK_CUR : SEEK_SET); in llseek_loop() 54 lseek(fds[(i + 1) % 2], i, (i / 2) % 2 ? SEEK_CUR : SEEK_SET); in llseek_loop() 56 close(fds[0]); in llseek_loop() 57 close(fds[1]); in llseek_loop()
|
/kernel/linux/linux-5.10/tools/testing/selftests/net/mptcp/ |
D | mptcp_connect.c | 341 struct pollfd fds = { in copyfd_io_poll() local 354 if (fds.events == 0) in copyfd_io_poll() 357 switch (poll(&fds, 1, poll_timeout)) { in copyfd_io_poll() 366 fds.events & POLLIN, fds.events & POLLOUT); in copyfd_io_poll() 370 if (fds.revents & POLLIN) { in copyfd_io_poll() 376 fds.events &= ~POLLIN; in copyfd_io_poll() 378 if ((fds.events & POLLOUT) == 0) in copyfd_io_poll() 391 if (fds.revents & POLLOUT) { in copyfd_io_poll() 408 fds.events &= ~POLLOUT; in copyfd_io_poll() 410 if ((fds.events & POLLIN) == 0) in copyfd_io_poll() [all …]
|
/kernel/linux/linux-5.10/arch/um/os-Linux/drivers/ |
D | tuntap_user.c | 133 int err, fds[2], len, used; in tuntap_open() local 159 err = socketpair(AF_UNIX, SOCK_DGRAM, 0, fds); in tuntap_open() 172 err = tuntap_open_tramp(pri->gate_addr, &pri->fd, fds[0], in tuntap_open() 173 fds[1], buffer, len, &used); in tuntap_open() 189 close(fds[0]); in tuntap_open()
|
/kernel/linux/linux-5.10/samples/bpf/ |
D | xdpsock_user.c | 1102 struct pollfd *fds) in complete_tx_l2fwd() argument 1137 ret = poll(fds, num_socks, opt_timeout); in complete_tx_l2fwd() 1175 static void rx_drop(struct xsk_socket_info *xsk, struct pollfd *fds) in rx_drop() argument 1185 ret = poll(fds, num_socks, opt_timeout); in rx_drop() 1196 ret = poll(fds, num_socks, opt_timeout); in rx_drop() 1220 struct pollfd fds[MAX_SOCKS] = {}; in rx_drop_all() local 1224 fds[i].fd = xsk_socket__fd(xsks[i]->xsk); in rx_drop_all() 1225 fds[i].events = POLLIN; in rx_drop_all() 1232 ret = poll(fds, num_socks, opt_timeout); in rx_drop_all() 1238 rx_drop(xsks[i], fds); in rx_drop_all() [all …]
|