Home
last modified time | relevance | path

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

1234

/linux/tools/testing/selftests/net/
H A Dpsock_fanout.c263 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument
267 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read()
268 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read()
332 int fds[2]; in test_control_group() local
339 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group()
340 if (fds[0] == -1) { in test_control_group()
360 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group()
361 if (fds[1] == -1) { in test_control_group()
367 if (close(fds[1]) || close(fds[0])) { in test_control_group()
376 int fds[3]; in test_control_group_max_num_members() local
[all …]
H A Dpsock_lib.h73 static __maybe_unused void pair_udp_open(int fds[], uint16_t port) in pair_udp_open() argument
77 fds[0] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
78 fds[1] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
79 if (fds[0] == -1 || fds[1] == -1) { in pair_udp_open()
95 if (bind(fds[1], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
99 if (bind(fds[0], (void *) &saddr, sizeof(saddr))) { in pair_udp_open()
103 if (connect(fds[0], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
109 static __maybe_unused void pair_udp_send_char(int fds[], int num, char payload) in pair_udp_send_char() argument
116 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) { in pair_udp_send_char()
120 if (read(fds[1], rbuf, sizeof(rbuf)) != sizeof(rbuf)) { in pair_udp_send_char()
[all …]
H A Dip_local_port_range.c232 int fds[2], i; in TEST_F() local
236 for (i = 0; i < ARRAY_SIZE(fds); i++) { in TEST_F()
255 fds[i] = fd; in TEST_F()
258 for (i = 0; i < ARRAY_SIZE(fds); i++) in TEST_F()
259 ASSERT_TRUE(close(fds[i]) == 0) TH_LOG("#%d: close failed", i); in TEST_F()
310 int fds[8]; in TEST_F() local
312 for (i = 0; i < ARRAY_SIZE(fds); i++) { in TEST_F()
328 fds[i] = fd; in TEST_F()
349 for (i = 0; i < ARRAY_SIZE(fds); i++) { in TEST_F()
350 err = close(fds[i]); in TEST_F()
/linux/tools/testing/selftests/pidfd/
H A Dpidfd_info_test.c203 struct pollfd fds = {}; in TEST_F() local
206 fds.events = POLLIN; in TEST_F()
207 fds.fd = self->child_pidfd2; in TEST_F()
209 nevents = poll(&fds, 1, -1); in TEST_F()
211 ASSERT_TRUE(!!(fds.revents & POLLIN)); in TEST_F()
212 ASSERT_TRUE(!!(fds.revents & POLLHUP)); in TEST_F()
243 struct pollfd fds = {}; in TEST_F() local
282 fds.events = POLLIN; in TEST_F()
283 fds.fd = pidfd_leader_thread; in TEST_F()
284 nevents = poll(&fds, 1, 10000 /* wait 5 seconds */); in TEST_F()
[all …]
H A 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()
/linux/io_uring/
H A Dopenclose.c311 int __user *fds; member
324 p->fds = u64_to_user_ptr(READ_ONCE(sqe->addr)); in io_pipe_prep()
339 int ret, fds[2] = { -1, -1 }; in io_pipe_fixed() local
350 fds[0] = ret; in io_pipe_fixed()
363 fds[1] = ret; in io_pipe_fixed()
368 if (!copy_to_user(p->fds, fds, sizeof(fds))) in io_pipe_fixed()
374 if (fds[0] != -1) in io_pipe_fixed()
375 io_fixed_fd_remove(ctx, fds[0]); in io_pipe_fixed()
376 if (fds[1] != -1) in io_pipe_fixed()
377 io_fixed_fd_remove(ctx, fds[1]); in io_pipe_fixed()
[all …]
/linux/Documentation/translations/zh_CN/accounting/
H A Dpsi.rst109 struct pollfd fds;
112 fds.fd = open("/proc/pressure/memory", O_RDWR | O_NONBLOCK);
113 if (fds.fd < 0) {
118 fds.events = POLLPRI;
120 if (write(fds.fd, trig, strlen(trig) + 1) < 0) {
128 n = poll(&fds, 1, -1);
133 if (fds.revents & POLLERR) {
137 if (fds.revents & POLLPRI) {
140 printf("unknown event received: 0x%x\n", fds.revents);
/linux/arch/um/drivers/
H A Dubd_user.c30 int 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()
H A Dchan_user.c243 int fds[2], n, err, pid; in winch_tramp() local
246 err = os_pipe(fds, 1, 1); in winch_tramp()
254 .pipe_fd = fds[1] } ); in winch_tramp()
269 *fd_out = fds[0]; in winch_tramp()
270 n = read(fds[0], &c, sizeof(c)); in winch_tramp()
290 close(fds[1]); in winch_tramp()
291 close(fds[0]); in winch_tramp()
H A Dvector_kern.c351 mmsg_vector->msg_hdr.msg_name = vp->fds->remote_addr; in vector_enqueue()
352 mmsg_vector->msg_hdr.msg_namelen = vp->fds->remote_addr_size; in vector_enqueue()
417 vp->fds->tx_fd, in vector_send()
797 if (vp->fds != NULL) in vector_remove()
865 pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); in vector_legacy_rx()
918 vp->fds->tx_fd, in writev_tx()
971 vp->fds->rx_fd, qi->mmsg_vector, budget, 0); in vector_mmsg_rx()
1048 deactivate_fd(vp->fds->rx_fd, vp->rx_irq); in vector_net_start_xmit()
1049 if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) in vector_net_start_xmit()
1050 deactivate_fd(vp->fds->tx_fd, vp->tx_irq); in vector_net_start_xmit()
[all …]
/linux/tools/testing/selftests/bpf/benchs/
H A Dbench_local_storage_create.c13 int *fds; member
120 t->fds = malloc(batch_sz * sizeof(*t->fds)); in setup()
121 if (!t->fds) { in setup()
149 int *fds = t->fds; in sk_producer() local
154 fds[i] = socket(AF_INET6, SOCK_DGRAM, 0); in sk_producer()
155 if (fds[i] == -1) in sk_producer()
160 if (fds[i] != -1) in sk_producer()
161 close(fds[i]); in sk_producer()
/linux/tools/testing/vsock/
H A Dvsock_perf.c204 struct pollfd fds = { 0 }; in run_receiver() local
206 fds.fd = client_fd; in run_receiver()
207 fds.events = POLLIN | POLLERR | in run_receiver()
210 if (poll(&fds, 1, -1) < 0) in run_receiver()
213 if (fds.revents & POLLERR) { in run_receiver()
218 if (fds.revents & POLLIN) { in run_receiver()
223 bytes_read = read(fds.fd, data, buf_size_bytes); in run_receiver()
238 if (fds.revents & (POLLHUP | POLLRDHUP)) in run_receiver()
329 struct pollfd fds = { 0 }; in run_sender() local
331 fds.fd = fd; in run_sender()
[all …]
H A Dvsock_test.c208 int fds[MULTICONN_NFDS]; in test_stream_multiconn_client() local
212 fds[i] = vsock_stream_connect(opts->peer_cid, opts->peer_port); in test_stream_multiconn_client()
213 if (fds[i] < 0) { in test_stream_multiconn_client()
221 recv_byte(fds[i], 1, 0); in test_stream_multiconn_client()
223 send_byte(fds[i], 1, 0); in test_stream_multiconn_client()
227 close(fds[i]); in test_stream_multiconn_client()
232 int fds[MULTICONN_NFDS]; in test_stream_multiconn_server() local
236 fds[i] = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL); in test_stream_multiconn_server()
237 if (fds[i] < 0) { in test_stream_multiconn_server()
245 send_byte(fds[ in test_stream_multiconn_server()
834 struct pollfd fds; test_stream_poll_rcvlowat_client() local
1444 struct pollfd fds; test_stream_credit_update_test() local
1606 struct pollfd fds = { 0 }; test_stream_msgzcopy_leak_errq_client() local
[all...]
/linux/samples/nitro_enclaves/
H A Dne_ioctl_sample.c199 struct pollfd fds[1] = {}; in ne_poll_enclave_fd() local
205 fds[0].fd = enclave_fd; in ne_poll_enclave_fd()
206 fds[0].events = POLLIN | POLLERR | POLLHUP; in ne_poll_enclave_fd()
212 rc = poll(fds, 1, NE_POLL_WAIT_TIME_MS); in ne_poll_enclave_fd()
228 printf("Poll received value 0x%x\n", fds[0].revents); in ne_poll_enclave_fd()
230 if (fds[0].revents & POLLHUP) { in ne_poll_enclave_fd()
236 if (fds[0].revents & POLLNVAL) { in ne_poll_enclave_fd()
656 struct pollfd fds[1] = {}; in ne_start_enclave_check_booted() local
696 fds[0].fd = server_vsock_fd; in ne_start_enclave_check_booted()
697 fds[0].events = POLLIN; in ne_start_enclave_check_booted()
[all …]
/linux/arch/um/os-Linux/
H A Dfile.c365 int os_pipe(int *fds, int stream, int close_on_exec) in os_pipe() argument
369 err = socketpair(AF_UNIX, type, 0, fds); in os_pipe()
376 err = os_set_exec_close(fds[0]); in os_pipe()
380 err = os_set_exec_close(fds[1]); in os_pipe()
389 close(fds[1]); in os_pipe()
390 close(fds[0]); in os_pipe()
507 ssize_t os_rcv_fd_msg(int fd, int *fds, unsigned int n_fds, in os_rcv_fd_msg() argument
511 char buf[CMSG_SPACE(sizeof(*fds) * MAX_RCV_FDS)]; in os_rcv_fd_msg()
521 .msg_controllen = CMSG_SPACE(sizeof(*fds) * n_fds), in os_rcv_fd_msg()
538 memcpy(fds, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0)); in os_rcv_fd_msg()
[all …]
/linux/tools/testing/selftests/bpf/prog_tests/
H A Dsock_iter_batch.c89 static int get_seen_socket(int *fds, struct sock_count counts[], int n) in get_seen_socket() argument
94 if (was_seen(fds[i], counts, n)) in get_seen_socket()
99 static int get_nth_socket(int *fds, int fds_len, struct bpf_link *link, int n) in get_nth_socket() argument
116 if (fds[i] >= 0 && socket_cookie(fds[i]) == out.cookie) in get_nth_socket()
175 static void check_n_were_seen_once(int *fds, int fds_len, int n, in check_n_were_seen_once() argument
186 if (fds[i] < 0) in check_n_were_seen_once()
188 seen_cnt = get_seen_count(fds[i], counts, counts_len); in check_n_were_seen_once()
785 int *fds = NULL; in do_resume_test() local
807 fds = start_reuseport_server(tc->family, tc->sock_type, addr, port, 0, in do_resume_test()
809 if (!ASSERT_OK_PTR(fds, "start_reuseport_server")) in do_resume_test()
[all …]
H A Dlwt_helpers.h74 fd_set fds; in wait_for_packet() local
76 FD_ZERO(&fds); in wait_for_packet()
82 FD_SET(fd, &fds); in wait_for_packet()
84 ret = select(1 + fd, &fds, NULL, NULL, &copied_timeout); in wait_for_packet()
/linux/tools/perf/bench/
H A Dsched-messaging.c66 static void fdpair(int fds[2]) in fdpair()
69 if (pipe(fds) == 0) in fdpair()
72 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0) in fdpair()
224 int fds[2]; in group() local
233 fdpair(fds); in group()
236 ctx->in_fds[0] = fds[0]; in group()
237 ctx->in_fds[1] = fds[1]; in group()
243 snd_ctx->out_fds[i] = fds[1]; in group()
245 close(fds[0]); in group()
/linux/samples/cgroup/
H A Dmemcg_event_listener.c227 struct pollfd fds[1]; in monitor_events() local
232 fds[0].fd = events->inotify_fd; in monitor_events()
233 fds[0].events = POLLIN; in monitor_events()
236 ret = poll(fds, ARRAY_SIZE(fds), -1); in monitor_events()
240 if (fds[0].revents & POLLERR) in monitor_events()
243 if (fds[0].revents & POLLIN) { in monitor_events()
248 length = read(fds[0].fd, buffer, INOTIFY_BUFFER_SIZE); in monitor_events()
/linux/tools/testing/selftests/cgroup/
H A Dwait_inotify.c33 struct pollfd fds = { .events = POLLIN, }; in main() local
59 fds.fd = fd; in main()
65 int ret = poll(&fds, 1, 10000); in main()
73 if ((ret > 0) && (fds.revents & POLLIN)) in main()
/linux/tools/include/nolibc/sys/
H A Dselect.h21 unsigned long fds[(FD_SETSIZE + FD_SETBITMASK) / FD_SETIDXMASK]; member
28 __set->fds[__fd / FD_SETIDXMASK] &= \
36 __set->fds[__fd / FD_SETIDXMASK] |= \
45 __r = !!(__set->fds[__fd / FD_SETIDXMASK] & \
55 __set->fds[__idx] = 0; \
/linux/tools/testing/selftests/bpf/
H A Dnetwork_helpers.c187 int *fds; in start_reuseport_server()
195 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server()
196 if (!fds) in start_reuseport_server()
199 fds[0] = start_server_addr(type, &addr, addrlen, &opts); in start_reuseport_server()
200 if (fds[0] == -1) in start_reuseport_server()
204 if (getsockname(fds[0], (struct sockaddr *)&addr, &addrlen)) in start_reuseport_server()
208 fds[nr_fds] = start_server_addr(type, &addr, addrlen, &opts); in start_reuseport_server()
209 if (fds[nr_fds] == -1) in start_reuseport_server()
213 return fds;
181 int *fds; start_reuseport_server() local
214 free_fds(int * fds,unsigned int nr_close_fds) free_fds() argument
922 fd_set fds; traffic_monitor_thread() local
[all...]
/linux/tools/bpf/bpftool/
H A Dmap.c633 int *fds = NULL; in do_show_subset() local
637 fds = malloc(sizeof(int)); in do_show_subset()
638 if (!fds) { in do_show_subset()
642 nb_fds = map_parse_fds(&argc, &argv, &fds, BPF_F_RDONLY); in do_show_subset()
649 err = bpf_map_get_info_by_fd(fds[i], &info, &len); in do_show_subset()
654 close(fds[i]); in do_show_subset()
659 show_map_close_json(fds[i], &info); in do_show_subset()
661 show_map_close_plain(fds[i], &info); in do_show_subset()
663 close(fds[i]); in do_show_subset()
669 free(fds); in do_show_subset()
771 maps_have_btf(int * fds,int nb_fds) maps_have_btf() argument
904 int *fds = NULL; do_dump() local
[all...]
/linux/tools/testing/selftests/ublk/
H A Dcommon.c10 fsync(dev->fds[i]); in backing_file_tgt_deinit()
11 close(dev->fds[i]); in backing_file_tgt_deinit()
50 dev->fds[dev->nr_fds] = fd; in backing_file_tgt_init()
/linux/tools/testing/selftests/sync/
H A 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()

1234