Home
last modified time | relevance | path

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

12345

/linux/tools/testing/selftests/net/
H A Dpsock_fanout.c269 int fds[2]; in test_control_group() local
274 if (fds[0] == -1) { in test_control_group()
293 if (fds[1] == -1) { in test_control_group()
297 if (close(fds[1]) || close(fds[0])) { in test_control_group()
306 int fds[3]; in test_control_group_max_num_members() local
319 if (fds[0] == -1) { in test_control_group_max_num_members()
347 if (close(fds[2]) || close(fds[1]) || close(fds[0])) { in test_control_group_max_num_members()
356 int fds[3]; in test_unique_fanout_group_ids() local
402 if (close(fds[0]) || close(fds[1]) || close(fds[2])) { in test_unique_fanout_group_ids()
422 if (fds[0] == -1 || fds[1] == -1) { in test_datapath()
[all …]
H A Dpsock_lib.h81 fds[0] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
82 fds[1] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
83 if (fds[0] == -1 || fds[1] == -1) { in pair_udp_open()
99 if (bind(fds[1], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
103 if (bind(fds[0], (void *) &saddr, sizeof(saddr))) { in pair_udp_open()
107 if (connect(fds[0], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
120 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) { in pair_udp_send_char()
137 return pair_udp_send_char(fds, num, DATA_CHAR); in pair_udp_send()
140 static __maybe_unused void pair_udp_close(int fds[]) in pair_udp_close() argument
142 close(fds[0]); in pair_udp_close()
[all …]
/linux/tools/bpf/bpftool/
H A Dcommon.c861 *fds = tmp; in prog_fd_by_nametag()
931 if ((*fds)[0] < 0) in prog_parse_fds()
942 int *fds = NULL; in prog_parse_fd() local
946 if (!fds) { in prog_parse_fd()
961 fd = fds[0]; in prog_parse_fd()
963 free(fds); in prog_parse_fd()
1012 *fds = tmp; in map_fd_by_name()
1079 int *fds = NULL; in map_parse_fd() local
1083 if (!fds) { in map_parse_fd()
1098 fd = fds[0]; in map_parse_fd()
[all …]
/linux/fs/
H A Dselect.c414 #define FDS_IN(fds, n) (fds->in + n) argument
415 #define FDS_OUT(fds, n) (fds->out + n) argument
416 #define FDS_EX(fds, n) (fds->ex + n) argument
418 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n)) argument
434 set &= BITS(fds, n); in max_select_fd()
444 set = BITS(fds, n); in max_select_fd()
512 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select()
513 rinp = fds->res_in; routp = fds->res_out; rexp = fds->res_ex; in do_select()
628 fd_set_bits fds; in core_sys_select() local
666 fds.in = bits; in core_sys_select()
[all …]
/linux/arch/um/os-Linux/
H A Dhelper.c47 int pid, fds[2], ret, n; in run_helper() local
53 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); in run_helper()
61 ret = os_set_exec_close(fds[1]); in run_helper()
72 data.fd = fds[1]; in run_helper()
83 close(fds[1]); in run_helper()
84 fds[1] = -1; in run_helper()
90 n = read(fds[0], &ret, sizeof(ret)); in run_helper()
110 if (fds[1] != -1) in run_helper()
111 close(fds[1]); in run_helper()
112 close(fds[0]); in run_helper()
H A 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()
/linux/tools/testing/selftests/bpf/prog_tests/
H A Dsock_iter_batch.c18 int *fds[2] = {}; in do_test() local
25 for (i = 0; i < ARRAY_SIZE(fds); i++) { in do_test()
28 fds[i] = start_reuseport_server(AF_INET6, sock_type, "::1", 0, 0, in do_test()
30 if (!ASSERT_OK_PTR(fds[i], "start_reuseport_server")) in do_test()
32 local_port = get_socket_local_port(*fds[i]); in do_test()
75 free_fds(fds[first_idx], nr_soreuse); in do_test()
76 fds[first_idx] = NULL; in do_test()
103 for (i = 0; i < ARRAY_SIZE(fds); i++) in do_test()
104 free_fds(fds[i], nr_soreuse); in do_test()
H A Dlwt_helpers.h103 fd_set fds; in wait_for_packet() local
105 FD_ZERO(&fds); in wait_for_packet()
111 FD_SET(fd, &fds); in wait_for_packet()
113 ret = select(1 + fd, &fds, NULL, NULL, &copied_timeout); in wait_for_packet()
/linux/arch/um/drivers/
H A 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()
H A 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()
H A 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()
H A 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()
H A Dchan_user.c229 int fds[2], n, err, pid; in winch_tramp() local
232 err = os_pipe(fds, 1, 1); in winch_tramp()
240 .pipe_fd = fds[1] } ); in winch_tramp()
255 *fd_out = fds[0]; in winch_tramp()
256 n = read(fds[0], &c, sizeof(c)); in winch_tramp()
276 close(fds[1]); in winch_tramp()
277 close(fds[0]); in winch_tramp()
H A Dvector_kern.c429 vp->fds->tx_fd, in vector_send()
804 if (vp->fds != NULL) in vector_remove()
924 vp->fds->tx_fd, in writev_tx()
1055 if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) in vector_net_start_xmit()
1125 if (vp->fds == NULL) in vector_net_close()
1139 if (vp->fds->rx_fd > 0) { in vector_net_close()
1143 vp->fds->rx_fd = -1; in vector_net_close()
1147 vp->fds->tx_fd = -1; in vector_net_close()
1161 kfree(vp->fds); in vector_net_close()
1162 vp->fds = NULL; in vector_net_close()
[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/tools/testing/selftests/pidfd/
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/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()
238 if (fds.revents & (POLLHUP | POLLRDHUP)) in run_receiver()
319 struct pollfd fds = { 0 }; in run_sender() local
321 fds.fd = fd; in run_sender()
323 if (poll(&fds, 1, -1) < 0) { in run_sender()
[all …]
H A Dvsock_test.c219 if (fds[i] < 0) { in test_stream_multiconn_client()
233 close(fds[i]); in test_stream_multiconn_client()
243 if (fds[i] < 0) { in test_stream_multiconn_server()
257 close(fds[i]); in test_stream_multiconn_server()
838 struct pollfd fds; in test_stream_poll_rcvlowat_client() local
857 fds.fd = fd; in test_stream_poll_rcvlowat_client()
868 if (fds.revents) { in test_stream_poll_rcvlowat_client()
870 fds.revents); in test_stream_poll_rcvlowat_client()
886 fds.revents); in test_stream_poll_rcvlowat_client()
1286 struct pollfd fds; in test_stream_credit_update_test() 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()
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()
699 rc = poll(fds, 1, NE_POLL_WAIT_TIME_MS); in ne_start_enclave_check_booted()
[all …]
/linux/tools/testing/selftests/bpf/
H A Dnetwork_helpers.c153 int *fds; in start_reuseport_server() local
161 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server()
162 if (!fds) in start_reuseport_server()
166 if (fds[0] == -1) in start_reuseport_server()
175 if (fds[nr_fds] == -1) in start_reuseport_server()
179 return fds; in start_reuseport_server()
182 free_fds(fds, nr_fds); in start_reuseport_server()
195 void free_fds(int *fds, unsigned int nr_close_fds) in free_fds() argument
197 if (fds) { in free_fds()
199 close(fds[--nr_close_fds]); in free_fds()
[all …]
/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/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.c229 struct pollfd fds[1]; in monitor_events() local
234 fds[0].fd = events->inotify_fd; in monitor_events()
235 fds[0].events = POLLIN; in monitor_events()
238 ret = poll(fds, ARRAY_SIZE(fds), -1); in monitor_events()
242 if (fds[0].revents & POLLERR) in monitor_events()
245 if (fds[0].revents & POLLIN) { in monitor_events()
250 length = read(fds[0].fd, buffer, INOTIFY_BUFFER_SIZE); in monitor_events()
/linux/tools/include/nolibc/
H A Dtypes.h122 unsigned long fds[(FD_SETSIZE + FD_SETBITMASK) / FD_SETIDXMASK]; member
129 __set->fds[__fd / FD_SETIDXMASK] &= \
137 __set->fds[__fd / FD_SETIDXMASK] |= \
146 __r = !!(__set->fds[__fd / FD_SETIDXMASK] & \
156 __set->fds[__idx] = 0; \

12345