/linux/tools/testing/selftests/net/ |
H A D | psock_fanout.c | 263 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[ in test_control_group() 376 int fds[3]; test_control_group_max_num_members() local 426 int fds[3]; test_unique_fanout_group_ids() local 484 int fds[2], fds_udp[2][2], ret; test_datapath() local [all...] |
H A D | ip_local_port_range.c | 232 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[ in TEST_F() [all...] |
/linux/tools/testing/selftests/pidfd/ |
H A D | pidfd_info_test.c | 203 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, in TEST_F() 421 struct pollfd fds = {}; TEST_F() local 570 struct pollfd fds = {}; TEST_F() local [all...] |
H A D | pidfd_poll_test.c | 28 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 D | openclose.c | 282 /* ensure the task's creds are used when installing/receiving fds */ in io_install_fixed_fd_prep() 310 int __user *fds; member 323 p->fds = u64_to_user_ptr(READ_ONCE(sqe->addr)); in io_pipe_prep() 338 int ret, fds[2] = { -1, -1 }; in io_pipe_fixed() local 349 fds[0] = ret; in io_pipe_fixed() 362 fds[1] = ret; in io_pipe_fixed() 367 if (!copy_to_user(p->fds, fds, sizeof(fds))) in io_pipe_fixed() 373 if (fds[ in io_pipe_fixed() 384 int ret, fds[2] = { -1, -1 }; io_pipe_fd() local [all...] |
/linux/tools/include/nolibc/ |
H A D | poll.h | 20 * int poll(struct pollfd *fds, int nfds, int timeout); 24 int sys_poll(struct pollfd *fds, int nfds, int timeout) in sys_poll() argument 33 return my_syscall5(__NR_ppoll, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); in sys_poll() 41 return my_syscall5(__NR_ppoll_time64, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); in sys_poll() 43 return my_syscall3(__NR_poll, fds, nfds, timeout); in sys_poll() 45 return __nolibc_enosys(__func__, fds, nfds, timeout); in sys_poll() 50 int poll(struct pollfd *fds, int nfds, int timeout) in poll() argument 52 return __sysret(sys_poll(fds, nfds, timeout)); in poll()
|
H A D | types.h | 123 unsigned long fds[(FD_SETSIZE + FD_SETBITMASK) / FD_SETIDXMASK]; member 130 __set->fds[__fd / FD_SETIDXMASK] &= \ 138 __set->fds[__fd / FD_SETIDXMASK] |= \ 147 __r = !!(__set->fds[__fd / FD_SETIDXMASK] & \ 157 __set->fds[__idx] = 0; \
|
/linux/fs/ |
H A D | select.c | 15 * of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian). 411 #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, argument 417 max_select_fd(unsigned long n,fd_set_bits * fds) max_select_fd() argument 483 do_select(int n,fd_set_bits * fds,struct timespec64 * end_time) do_select() argument 624 fd_set_bits fds; core_sys_select() local 1016 struct pollfd *fds = walk->entries; do_sys_poll() local 1192 fd_set_bits fds; compat_core_sys_select() local [all...] |
/linux/tools/bpf/bpftool/ |
H A D | common.c | 810 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument 860 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag() 865 *fds = tmp; in prog_fd_by_nametag() 867 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag() 874 close((*fds)[nb_fds]); in prog_fd_by_nametag() 878 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument 893 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds() 894 if ((*fds)[0] < 0) { in prog_parse_fds() 912 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds() 925 return prog_fd_by_nametag(name, fds, fals in prog_parse_fds() 946 int *fds = NULL; prog_parse_fd() local 971 map_fd_by_name(char * name,int ** fds,const struct bpf_get_fd_by_id_opts * opts) map_fd_by_name() argument 1046 map_parse_fds(int * argc,char *** argv,int ** fds,__u32 open_flags) map_parse_fds() argument 1107 int *fds = NULL; map_parse_fd() local [all...] |
/linux/arch/um/drivers/ |
H A D | ubd_user.c | 30 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 D | chan_user.c | 243 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 D | vector_kern.c | 351 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 in vector_net_start_xmit() [all...] |
/linux/Documentation/translations/zh_CN/accounting/ |
H A D | psi.rst | 109 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/bpf/ |
H A D | io_helpers.c | 10 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()
|
H A D | network_helpers.c | 181 int *fds; in start_reuseport_server() local 189 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server() 190 if (!fds) in start_reuseport_server() 193 fds[0] = start_server_addr(type, &addr, addrlen, &opts); in start_reuseport_server() 194 if (fds[0] == -1) in start_reuseport_server() 198 if (getsockname(fds[0], (struct sockaddr *)&addr, &addrlen)) in start_reuseport_server() 202 fds[nr_fds] = start_server_addr(type, &addr, addrlen, &opts); in start_reuseport_server() 203 if (fds[nr_fds] == -1) in start_reuseport_server() 207 return fds; in start_reuseport_server() 214 free_fds(int * fds,unsigned int nr_close_fds) free_fds() argument 962 fd_set fds; traffic_monitor_thread() local [all...] |
/linux/arch/um/os-Linux/ |
H A D | helper.c | 48 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[ in run_helper() [all...] |
/linux/tools/testing/selftests/bpf/benchs/ |
H A D | bench_local_storage_create.c | 13 int *fds; member 120 t->fds = malloc(batch_sz * sizeof(*t->fds)); in setup() 121 if (!t->fds) { in setup() 122 fprintf(stderr, "cannot alloc t->fds\n"); 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[ in sk_producer() [all...] |
/linux/samples/nitro_enclaves/ |
H A D | ne_ioctl_sample.c | 199 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[ in ne_start_enclave_check_booted() [all...] |
/linux/tools/testing/selftests/cgroup/ |
H A D | wait_inotify.c | 33 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 D | sched-messaging.c | 66 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() 248 /* Now we have all the fds, for in group() [all...] |
/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | sock_iter_batch.c | 89 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() 337 /* Make sure we saw a socket from fds. */ in remove_unseen() 415 /* Make sure we saw a socket from fds in remove_all() 785 int *fds = NULL; do_resume_test() local 873 int *fds[2] = {}; do_test() local [all...] |
H A D | lwt_helpers.h | 74 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/samples/cgroup/ |
H A D | memcg_event_listener.c | 229 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/drivers/vfio/cdx/ |
H A D | intr.c | 104 int32_t *fds) in vfio_cdx_msi_set_block() argument 112 int fd = fds ? fds[i] : -1; in vfio_cdx_msi_set_block() 161 s32 *fds = data; in vfio_cdx_set_msi_trigger() local 166 fds); in vfio_cdx_set_msi_trigger() 171 ret = vfio_cdx_msi_set_block(vdev, start, count, fds); in vfio_cdx_set_msi_trigger()
|
/linux/tools/testing/vsock/ |
H A D | vsock_test.c | 208 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...] |