Home
last modified time | relevance | path

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

12345

/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 …]
/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/fs/
H A Dselect.c411 #define FDS_IN(fds, n) (fds->in + n) argument
412 #define FDS_OUT(fds, n) (fds->out + n) argument
413 #define FDS_EX(fds, n) (fds->ex + n) argument
415 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n)) argument
417 static int max_select_fd(unsigned long n, fd_set_bits *fds) in max_select_fd() argument
431 set &= BITS(fds, n); in max_select_fd()
441 set = BITS(fds, n); in max_select_fd()
483 static noinline_for_stack int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) in do_select() argument
494 retval = max_select_fd(n, fds); in do_select()
516 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select()
[all …]
/linux/io_uring/
H A Dopenclose.c320 int __user *fds; member
333 p->fds = u64_to_user_ptr(READ_ONCE(sqe->addr)); in io_pipe_prep()
349 int ret, fds[2] = { -1, -1 }; in io_pipe_fixed() local
362 fds[0] = alloc_slot ? ret : slot - 1; in io_pipe_fixed()
375 fds[1] = alloc_slot ? ret : slot - 1; in io_pipe_fixed()
380 if (!copy_to_user(p->fds, fds, sizeof(fds))) in io_pipe_fixed()
386 if (fds[0] != -1) in io_pipe_fixed()
387 io_fixed_fd_remove(ctx, fds[0]); in io_pipe_fixed()
388 if (fds[1] != -1) in io_pipe_fixed()
389 io_fixed_fd_remove(ctx, fds[1]); in io_pipe_fixed()
[all …]
/linux/tools/bpf/bpftool/
H A Dcommon.c812 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument
862 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag()
867 *fds = tmp; in prog_fd_by_nametag()
869 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag()
876 close((*fds)[nb_fds]); in prog_fd_by_nametag()
880 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument
895 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds()
896 if ((*fds)[0] < 0) { in prog_parse_fds()
914 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds()
927 return prog_fd_by_nametag(name, fds, fals in prog_parse_fds()
948 int *fds = NULL; prog_parse_fd() local
973 map_fd_by_name(char * name,int ** fds,const struct bpf_get_fd_by_id_opts * opts) map_fd_by_name() argument
1048 map_parse_fds(int * argc,char *** argv,int ** fds,__u32 open_flags) map_parse_fds() argument
1109 int *fds = NULL; map_parse_fd() local
[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.c352 mmsg_vector->msg_hdr.msg_name = vp->fds->remote_addr; in vector_enqueue()
353 mmsg_vector->msg_hdr.msg_namelen = vp->fds->remote_addr_size; in vector_enqueue()
418 vp->fds->tx_fd, in vector_send()
792 if (vp->fds != NULL) in vector_remove()
860 pkt_len = uml_vector_recvmsg(vp->fds->rx_fd, &hdr, 0); in vector_legacy_rx()
913 vp->fds->tx_fd, in writev_tx()
966 vp->fds->rx_fd, qi->mmsg_vector, budget, 0); in vector_mmsg_rx()
1043 deactivate_fd(vp->fds->rx_fd, vp->rx_irq); in vector_net_start_xmit()
1044 if ((vp->fds->rx_fd != vp->fds->tx_fd) && (vp->tx_irq != 0)) in vector_net_start_xmit()
1045 deactivate_fd(vp->fds->tx_fd, vp->tx_irq); in vector_net_start_xmit()
[all …]
/linux/arch/um/os-Linux/
H A Dhelper.c48 int pid, fds[2], ret, n; in run_helper() local
54 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); in run_helper()
62 ret = os_set_exec_close(fds[1]); in run_helper()
73 data.fd = fds[1]; in run_helper()
84 close(fds[1]); in run_helper()
85 fds[1] = -1; in run_helper()
91 n = read(fds[0], &ret, sizeof(ret)); in run_helper()
111 if (fds[1] != -1) in run_helper()
112 close(fds[1]); in run_helper()
113 close(fds[0]); in run_helper()
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/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/selftests/bpf/
H A Dio_helpers.c10 fd_set fds; in read_with_timeout() local
13 FD_ZERO(&fds); in read_with_timeout()
14 FD_SET(fd, &fds); in read_with_timeout()
15 err = select(fd + 1, &fds, NULL, NULL, &tv); in read_with_timeout()
18 if (FD_ISSET(fd, &fds)) in read_with_timeout()
/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_zerocopy.c152 struct pollfd fds = { 0 }; in test_client() local
194 fds.fd = fd; in test_client()
195 fds.events = 0; in test_client()
197 if (poll(&fds, 1, POLL_TIMEOUT_MS) < 0) { in test_client()
202 if (fds.revents & POLLERR) { in test_client()
370 struct pollfd fds; in test_stream_msgzcopy_mangle_client() local
392 fds.fd = fd; in test_stream_msgzcopy_mangle_client()
393 fds.events = 0; in test_stream_msgzcopy_mangle_client()
395 if (poll(&fds, 1, TIMEOUT * MSEC_PER_SEC) != 1 || in test_stream_msgzcopy_mangle_client()
396 !(fds.revents & POLLERR)) { in test_stream_msgzcopy_mangle_client()
/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/tools/include/nolibc/
H A Dpoll.h24 int sys_poll(struct pollfd *fds, int nfds, int timeout) in sys_poll() argument
33 return my_syscall5(__NR_ppoll_time64, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); in sys_poll()
41 return my_syscall5(__NR_ppoll, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); in sys_poll()
46 int poll(struct pollfd *fds, int nfds, int timeout) in poll() argument
48 return __sysret(sys_poll(fds, nfds, timeout)); in poll()
/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 …]
/linux/tools/lib/python/
H A Djobserver.py86 fds = split_opt[1]
91 if fds.startswith('fifo:'):
92 path = fds[len('fifo:'):]
103 split_fds = fds.split(',')
105 warn('malformed jobserver file descriptors:', fds)
111 warn('non-integer jobserver file-descriptors:', fds)
/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/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/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()

12345