Home
last modified time | relevance | path

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

123

/Linux-v5.4/tools/testing/selftests/net/
Dpsock_fanout.c221 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 …]
Dpsock_lib.h75 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 …]
/Linux-v5.4/fs/
Dselect.c413 #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()
476 static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) in do_select() argument
487 retval = max_select_fd(n, fds); in do_select()
509 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select()
[all …]
/Linux-v5.4/arch/um/os-Linux/
Dhelper.c46 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()
Dsigio.c53 struct pollfds *fds, tmp; in write_sigio_thread() local
59 fds = &current_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()
Dfile.c371 int os_pipe(int *fds, int stream, int close_on_exec) in os_pipe() argument
375 err = socketpair(AF_UNIX, type, 0, fds); in os_pipe()
382 err = os_set_exec_close(fds[0]); in os_pipe()
386 err = os_set_exec_close(fds[1]); in os_pipe()
395 close(fds[1]); in os_pipe()
396 close(fds[0]); in os_pipe()
633 int os_sendmsg_fds(int fd, const void *buf, unsigned int len, const int *fds, in os_sendmsg_fds() argument
641 char control[CMSG_SPACE(sizeof(*fds) * OS_SENDMSG_MAX_FDS)]; in os_sendmsg_fds()
644 unsigned int fds_size = sizeof(*fds) * fds_num; in os_sendmsg_fds()
660 memcpy(CMSG_DATA(cmsg), fds, fds_size); in os_sendmsg_fds()
/Linux-v5.4/arch/um/drivers/
Dubd_user.c30 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()
Dslirp_user.c52 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()
Dslip_user.c78 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()
Dchan_user.c223 int fds[2], n, err; in winch_tramp() local
226 err = os_pipe(fds, 1, 1); in winch_tramp()
234 .pipe_fd = fds[1] } ); in winch_tramp()
248 *fd_out = fds[0]; in winch_tramp()
249 n = read(fds[0], &c, sizeof(c)); in winch_tramp()
268 close(fds[1]); in winch_tramp()
269 close(fds[0]); in winch_tramp()
Dnet_user.c182 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()
Dvector_kern.c337 mmsg_vector->msg_hdr.msg_name = vp->fds->remote_addr; in vector_enqueue()
338 mmsg_vector->msg_hdr.msg_namelen = vp->fds->remote_addr_size; in vector_enqueue()
405 vp->fds->tx_fd, in vector_send()
782 if (vp->fds != NULL) in vector_remove()
849 pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); in vector_legacy_rx()
902 vp->fds->tx_fd, in writev_tx()
952 vp->fds->rx_fd, qi->mmsg_vector, qi->max_depth, 0); in vector_mmsg_rx()
1046 deactivate_fd(vp->fds->rx_fd, vp->rx_irq); in vector_net_start_xmit()
1047 if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) in vector_net_start_xmit()
1048 deactivate_fd(vp->fds->tx_fd, vp->tx_irq); in vector_net_start_xmit()
[all …]
/Linux-v5.4/samples/bpf/
Dxdpsock_user.c487 struct pollfd *fds) in complete_tx_l2fwd() argument
514 ret = poll(fds, num_socks, opt_timeout); in complete_tx_l2fwd()
548 static void rx_drop(struct xsk_socket_info *xsk, struct pollfd *fds) in rx_drop() argument
557 ret = poll(fds, num_socks, opt_timeout); in rx_drop()
566 ret = poll(fds, num_socks, opt_timeout); in rx_drop()
589 struct pollfd fds[MAX_SOCKS + 1]; in rx_drop_all() local
592 memset(fds, 0, sizeof(fds)); in rx_drop_all()
595 fds[i].fd = xsk_socket__fd(xsks[i]->xsk); in rx_drop_all()
596 fds[i].events = POLLIN; in rx_drop_all()
601 ret = poll(fds, num_socks, opt_timeout); in rx_drop_all()
[all …]
/Linux-v5.4/tools/testing/selftests/pidfd/
Dpidfd_poll_test.c29 struct pollfd fds; in main() local
33 fds.events = POLLIN; in main()
86 fds.fd = pidfd; in main()
87 nevents = poll(&fds, 1, -1); in main()
98 if (!(fds.revents & POLLIN)) in main()
101 fds.revents); in main()
/Linux-v5.4/tools/perf/bench/
Dsched-messaging.c53 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()
/Linux-v5.4/tools/perf/tests/
Dbpf.c42 int fds[2], i; in llseek_loop() local
44 fds[0] = open("/dev/null", O_RDONLY); in llseek_loop()
45 fds[1] = open("/dev/null", O_RDWR); in llseek_loop()
47 if (fds[0] < 0 || fds[1] < 0) in llseek_loop()
51 lseek(fds[i % 2], i, (i / 2) % 2 ? SEEK_CUR : SEEK_SET); in llseek_loop()
52 lseek(fds[(i + 1) % 2], i, (i / 2) % 2 ? SEEK_CUR : SEEK_SET); in llseek_loop()
54 close(fds[0]); in llseek_loop()
55 close(fds[1]); in llseek_loop()
/Linux-v5.4/arch/um/os-Linux/drivers/
Dtuntap_user.c133 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()
/Linux-v5.4/tools/testing/selftests/sync/
Dsync.c60 struct pollfd fds; in sync_wait() local
62 fds.fd = fd; in sync_wait()
63 fds.events = POLLIN | POLLERR; in sync_wait()
65 return poll(&fds, 1, timeout); in sync_wait()
/Linux-v5.4/tools/virtio/
Dvirtio_test.c38 struct pollfd fds[1]; member
109 dev->fds[info->idx].fd = info->call; in vq_info_add()
110 dev->fds[info->idx].events = POLLIN; in vq_info_add()
147 poll(dev->fds, dev->nvqs, -1); in wait_for_interrupt()
149 if (dev->fds[i].revents & POLLIN) { in wait_for_interrupt()
150 read(dev->fds[i].fd, &val, sizeof val); in wait_for_interrupt()
/Linux-v5.4/Documentation/accounting/
Dpsi.rst133 struct pollfd fds;
136 fds.fd = open("/proc/pressure/memory", O_RDWR | O_NONBLOCK);
137 if (fds.fd < 0) {
142 fds.events = POLLPRI;
144 if (write(fds.fd, trig, strlen(trig) + 1) < 0) {
152 n = poll(&fds, 1, -1);
157 if (fds.revents & POLLERR) {
161 if (fds.revents & POLLPRI) {
164 printf("unknown event received: 0x%x\n", fds.revents);
/Linux-v5.4/tools/usb/usbip/src/
Dusbipd.c497 struct pollfd *fds; in do_standalone_mode() local
546 fds = calloc(nsockfd, sizeof(struct pollfd)); in do_standalone_mode()
548 fds[i].fd = sockfdlist[i]; in do_standalone_mode()
549 fds[i].events = POLLIN; in do_standalone_mode()
562 r = ppoll(fds, nsockfd, &timeout, &sigmask); in do_standalone_mode()
568 if (fds[i].revents & POLLIN) { in do_standalone_mode()
580 free(fds); in do_standalone_mode()
/Linux-v5.4/tools/testing/selftests/powerpc/pmu/ebb/
Debb_on_child_test.c52 FAIL_IF(pipe(read_pipe.fds) == -1); in ebb_on_child()
53 FAIL_IF(pipe(write_pipe.fds) == -1); in ebb_on_child()
Dtask_event_vs_ebb_test.c45 FAIL_IF(pipe(read_pipe.fds) == -1); in task_event_vs_ebb()
46 FAIL_IF(pipe(write_pipe.fds) == -1); in task_event_vs_ebb()
Debb_on_willing_child_test.c59 FAIL_IF(pipe(read_pipe.fds) == -1); in ebb_on_willing_child()
60 FAIL_IF(pipe(write_pipe.fds) == -1); in ebb_on_willing_child()
/Linux-v5.4/drivers/staging/greybus/tools/
Dloopback_test.c101 struct pollfd fds[MAX_NUM_DEVICES]; member
652 t->fds[fds_idx].fd = open(buf, O_RDONLY); in open_poll_files()
653 if (t->fds[fds_idx].fd < 0) { in open_poll_files()
657 read(t->fds[fds_idx].fd, &dummy, 1); in open_poll_files()
658 t->fds[fds_idx].events = EPOLLERR|EPOLLPRI; in open_poll_files()
659 t->fds[fds_idx].revents = 0; in open_poll_files()
669 close(t->fds[i].fd); in open_poll_files()
678 close(t->fds[i].fd); in close_poll_files()
743 ret = ppoll(t->fds, t->poll_count, ts, &mask_old); in wait_for_complete()
751 if (t->fds[i].revents & EPOLLPRI) { in wait_for_complete()
[all …]

123