Home
last modified time | relevance | path

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

12

/tools/testing/selftests/net/
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 …]
Dpsock_fanout.c234 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument
238 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read()
239 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read()
268 int fds[2]; in test_control_group() local
272 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group()
273 if (fds[0] == -1) { in test_control_group()
291 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group()
292 if (fds[1] == -1) { in test_control_group()
296 if (close(fds[1]) || close(fds[0])) { in test_control_group()
305 int fds[3]; in test_control_group_max_num_members() local
[all …]
/tools/testing/selftests/pidfd/
Dpidfd_poll_test.c28 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()
/tools/bpf/bpftool/
Dcommon.c661 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument
702 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag()
707 *fds = tmp; in prog_fd_by_nametag()
709 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag()
716 close((*fds)[nb_fds]); in prog_fd_by_nametag()
720 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument
735 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds()
736 if ((*fds)[0] < 0) { in prog_parse_fds()
754 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds()
767 return prog_fd_by_nametag(name, fds, false); in prog_parse_fds()
[all …]
Dmap.c649 int *fds = NULL; in do_show_subset() local
653 fds = malloc(sizeof(int)); in do_show_subset()
654 if (!fds) { in do_show_subset()
658 nb_fds = map_parse_fds(&argc, &argv, &fds); in do_show_subset()
665 err = bpf_obj_get_info_by_fd(fds[i], &info, &len); in do_show_subset()
670 close(fds[i]); in do_show_subset()
675 show_map_close_json(fds[i], &info); in do_show_subset()
677 show_map_close_plain(fds[i], &info); in do_show_subset()
679 close(fds[i]); in do_show_subset()
685 free(fds); in do_show_subset()
[all …]
/tools/testing/selftests/bpf/
Dnetwork_helpers.c128 int *fds; in start_reuseport_server() local
136 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server()
137 if (!fds) in start_reuseport_server()
140 fds[0] = __start_server(type, (struct sockaddr *)&addr, addrlen, in start_reuseport_server()
142 if (fds[0] == -1) in start_reuseport_server()
146 if (getsockname(fds[0], (struct sockaddr *)&addr, &addrlen)) in start_reuseport_server()
150 fds[nr_fds] = __start_server(type, (struct sockaddr *)&addr, in start_reuseport_server()
152 if (fds[nr_fds] == -1) in start_reuseport_server()
156 return fds; in start_reuseport_server()
159 free_fds(fds, nr_fds); in start_reuseport_server()
[all …]
/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()
/tools/testing/vsock/
Dvsock_test.c209 int fds[MULTICONN_NFDS]; in test_stream_multiconn_client() local
213 fds[i] = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_multiconn_client()
214 if (fds[i] < 0) { in test_stream_multiconn_client()
222 recv_byte(fds[i], 1, 0); in test_stream_multiconn_client()
224 send_byte(fds[i], 1, 0); in test_stream_multiconn_client()
228 close(fds[i]); in test_stream_multiconn_client()
233 int fds[MULTICONN_NFDS]; in test_stream_multiconn_server() local
237 fds[i] = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_multiconn_server()
238 if (fds[i] < 0) { in test_stream_multiconn_server()
246 send_byte(fds[i], 1, 0); in test_stream_multiconn_server()
[all …]
/tools/perf/tests/
Dbpf.c44 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()
/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()
/tools/testing/selftests/powerpc/pmu/ebb/
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_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()
Debb_on_willing_child_test.c57 FAIL_IF(pipe(read_pipe.fds) == -1); in ebb_on_willing_child()
58 FAIL_IF(pipe(write_pipe.fds) == -1); in ebb_on_willing_child()
Dcpu_event_vs_ebb_test.c50 FAIL_IF(pipe(read_pipe.fds) == -1); in cpu_event_vs_ebb()
51 FAIL_IF(pipe(write_pipe.fds) == -1); in cpu_event_vs_ebb()
Debb_vs_cpu_event_test.c50 FAIL_IF(pipe(read_pipe.fds) == -1); in ebb_vs_cpu_event()
51 FAIL_IF(pipe(write_pipe.fds) == -1); in ebb_vs_cpu_event()
Dtask_event_pinned_vs_ebb_test.c47 FAIL_IF(pipe(read_pipe.fds) == -1); in task_event_pinned_vs_ebb()
48 FAIL_IF(pipe(write_pipe.fds) == -1); in task_event_pinned_vs_ebb()
Dcpu_event_pinned_vs_ebb_test.c52 FAIL_IF(pipe(read_pipe.fds) == -1); in cpu_event_pinned_vs_ebb()
53 FAIL_IF(pipe(write_pipe.fds) == -1); in cpu_event_pinned_vs_ebb()
/tools/testing/selftests/filesystems/binderfs/
Dbinderfs_test.c380 int fds[1000]; in TEST() local
418 for (int i = 0; i < ARRAY_SIZE(fds); i++) { in TEST()
439 fds[i] = open(device_path, O_RDONLY | O_CLOEXEC); in TEST()
440 ASSERT_GE(fds[i], 0) { in TEST()
457 for (k = 0; k < ARRAY_SIZE(fds); k++) { in TEST()
459 ret = pthread_create(&threads[i], &attr, binder_version_thread, INT_TO_PTR(fds[k])); in TEST()
478 for (k = 0; k < ARRAY_SIZE(fds); k++) in TEST()
479 close(fds[k]); in TEST()
/tools/testing/selftests/bpf/prog_tests/
Dbpf_iter_setsockopt.c22 static unsigned int set_bpf_cubic(int *fds, unsigned int nr_fds) in set_bpf_cubic() argument
27 if (setsockopt(fds[i], SOL_TCP, TCP_CONGESTION, "bpf_cubic", in set_bpf_cubic()
35 static unsigned int check_bpf_dctcp(int *fds, unsigned int nr_fds) in check_bpf_dctcp() argument
42 if (getsockopt(fds[i], SOL_TCP, TCP_CONGESTION, in check_bpf_dctcp()
Dmigrate_reuseport.c128 static void init_fds(__s64 fds[], int len) in init_fds() argument
133 fds[i] = -1; in init_fds()
136 static void close_fds(__s64 fds[], int len) in close_fds() argument
141 if (fds[i] != -1) { in close_fds()
142 close(fds[i]); in close_fds()
143 fds[i] = -1; in close_fds()
/tools/testing/selftests/powerpc/mm/
Dstack_expansion_signal.c77 FAIL_IF(pipe(read_pipe.fds) == -1); in test_one_size()
78 FAIL_IF(pipe(write_pipe.fds) == -1); in test_one_size()
/tools/testing/selftests/net/mptcp/
Dmptcp_connect.c456 struct pollfd fds = { in copyfd_io_poll() local
469 if (fds.events == 0) in copyfd_io_poll()
472 switch (poll(&fds, 1, poll_timeout)) { in copyfd_io_poll()
481 fds.events & POLLIN, fds.events & POLLOUT); in copyfd_io_poll()
485 if (fds.revents & POLLIN) { in copyfd_io_poll()
491 fds.events &= ~POLLIN; in copyfd_io_poll()
493 if ((fds.events & POLLOUT) == 0) { in copyfd_io_poll()
508 if (fds.revents & POLLOUT) { in copyfd_io_poll()
525 fds.events &= ~POLLOUT; in copyfd_io_poll()
527 if ((fds.events & POLLIN) == 0) in copyfd_io_poll()
[all …]
/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()
/tools/virtio/
Dvirtio_test.c41 struct pollfd fds[1]; member
122 dev->fds[info->idx].fd = info->call; in vq_info_add()
123 dev->fds[info->idx].events = POLLIN; in vq_info_add()
162 poll(dev->fds, dev->nvqs, -1); in wait_for_interrupt()
164 if (dev->fds[i].revents & POLLIN) { in wait_for_interrupt()
165 read(dev->fds[i].fd, &val, sizeof val); in wait_for_interrupt()
/tools/testing/selftests/powerpc/pmu/
Dlib.h20 int fds[2]; member

12