/kernel/linux/linux-6.6/tools/testing/selftests/net/ |
H A D | psock_fanout.c | 235 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument 239 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read() 240 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read() 269 int fds[2]; in test_control_group() local 273 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 274 if (fds[0] == -1) { in test_control_group() 292 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 293 if (fds[1] == -1) { in test_control_group() 297 if (close(fds[1]) || close(fds[ in test_control_group() 306 int fds[3]; test_control_group_max_num_members() local 356 int fds[3]; test_unique_fanout_group_ids() local 414 int fds[2], fds_udp[2][2], ret; test_datapath() local [all...] |
H A D | psock_lib.h | 77 static __maybe_unused void pair_udp_open(int fds[], uint16_t port) in pair_udp_open() argument 81 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() 113 static __maybe_unused void pair_udp_send_char(int fds[], int num, char payload) in pair_udp_send_char() argument 120 if (write(fds[ in pair_udp_send_char() 135 pair_udp_send(int fds[], int num) pair_udp_send() argument 140 pair_udp_close(int fds[]) pair_udp_close() argument [all...] |
/kernel/linux/linux-5.10/tools/testing/selftests/net/ |
H A D | psock_lib.h | 75 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[ in pair_udp_send_char() 133 pair_udp_send(int fds[], int num) pair_udp_send() argument 138 pair_udp_close(int fds[]) pair_udp_close() argument [all...] |
H A D | psock_fanout.c | 221 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument 225 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read() 226 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read() 255 int fds[2]; in test_control_group() local 259 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 260 if (fds[0] == -1) { in test_control_group() 278 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 279 if (fds[1] == -1) { in test_control_group() 283 if (close(fds[1]) || close(fds[ in test_control_group() 292 int fds[3]; test_unique_fanout_group_ids() local 350 int fds[2], fds_udp[2][2], ret; test_datapath() local [all...] |
/kernel/linux/linux-5.10/tools/bpf/bpftool/ |
H A D | common.c | 654 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument 695 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag() 700 *fds = tmp; in prog_fd_by_nametag() 702 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag() 709 close((*fds)[nb_fds]); in prog_fd_by_nametag() 713 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument 728 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds() 729 if ((*fds)[0] < 0) { in prog_parse_fds() 747 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds() 760 return prog_fd_by_nametag(name, fds, fals in prog_parse_fds() 781 int *fds = NULL; prog_parse_fd() local 806 map_fd_by_name(char *name, int **fds) map_fd_by_name() argument 864 map_parse_fds(int *argc, char ***argv, int **fds) map_parse_fds() argument 918 int *fds = NULL; map_parse_fd() local [all...] |
/kernel/linux/linux-5.10/fs/ |
H A D | select.c | 15 * of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian). 413 #define FDS_IN(fds, n) (fds->in + n) 414 #define FDS_OUT(fds, n) (fds->out + n) 415 #define FDS_EX(fds, n) (fds->ex + n) 417 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, 419 max_select_fd(unsigned long n, fd_set_bits *fds) max_select_fd() argument 478 do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) do_select() argument 627 fd_set_bits fds; core_sys_select() local 1021 struct pollfd *fds = walk->entries; do_sys_poll() local 1197 fd_set_bits fds; compat_core_sys_select() local [all...] |
/kernel/linux/linux-6.6/fs/ |
H A D | select.c | 15 * of fds to overcome nfds < 16390 descriptors limit (Tigran Aivazian). 414 #define FDS_IN(fds, n) (fds->in + n) 415 #define FDS_OUT(fds, n) (fds->out + n) 416 #define FDS_EX(fds, n) (fds->ex + n) 418 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, 420 max_select_fd(unsigned long n, fd_set_bits *fds) max_select_fd() argument 479 do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) do_select() argument 628 fd_set_bits fds; core_sys_select() local 1022 struct pollfd *fds = walk->entries; do_sys_poll() local 1198 fd_set_bits fds; compat_core_sys_select() local [all...] |
/kernel/linux/linux-6.6/tools/bpf/bpftool/ |
H A D | common.c | 734 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument 784 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag() 789 *fds = tmp; in prog_fd_by_nametag() 791 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag() 798 close((*fds)[nb_fds]); in prog_fd_by_nametag() 802 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument 817 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds() 818 if ((*fds)[0] < 0) { in prog_parse_fds() 836 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds() 849 return prog_fd_by_nametag(name, fds, fals in prog_parse_fds() 870 int *fds = NULL; prog_parse_fd() local 895 map_fd_by_name(char *name, int **fds) map_fd_by_name() argument 953 map_parse_fds(int *argc, char ***argv, int **fds) map_parse_fds() argument 1007 int *fds = NULL; map_parse_fd() local [all...] |
/kernel/linux/linux-5.10/arch/um/os-Linux/ |
H A D | helper.c | 46 int pid, fds[2], ret, n; in run_helper() local 52 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); in run_helper() 60 ret = os_set_exec_close(fds[1]); in run_helper() 71 data.fd = fds[1]; in run_helper() 82 close(fds[1]); in run_helper() 83 fds[1] = -1; in run_helper() 89 n = read(fds[0], &ret, sizeof(ret)); in run_helper() 105 if (fds[1] != -1) in run_helper() 106 close(fds[1]); in run_helper() 107 close(fds[ in run_helper() [all...] |
/kernel/linux/linux-6.6/arch/um/os-Linux/ |
H A D | helper.c | 47 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[ in run_helper() [all...] |
/kernel/linux/linux-5.10/arch/um/drivers/ |
H A D | ubd_user.c | 30 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 D | slirp_user.c | 52 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 D | slip_user.c | 78 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()
|
/kernel/linux/linux-6.6/arch/um/drivers/ |
H A D | ubd_user.c | 30 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 D | slirp_user.c | 52 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 D | slip_user.c | 78 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()
|
/kernel/linux/linux-5.10/tools/testing/selftests/pidfd/ |
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()
|
/kernel/linux/linux-6.6/tools/testing/selftests/pidfd/ |
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()
|
/kernel/liteos_a/testsuites/unittest/libc/io/full/ |
H A D | It_stdlib_poll_002.cpp | 42 struct pollfd fds[LISTEN_FD_NUM] = {0}; in Pthread01() local 47 fds[i].fd = g_pipeFd[i][0]; in Pthread01() 48 fds[i].events = pollEvents; in Pthread01() 52 ret = poll(fds, LISTEN_FD_NUM, 1000); // 1000, wait time. in Pthread01() 60 if (fds[i].revents & pollEvents) { in Pthread01() 61 ret = read(fds[i].fd, buffer, 12); // 12, "hello world" length and '\0' in Pthread01()
|
/kernel/linux/linux-6.6/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...] |
/kernel/liteos_m/kal/posix/src/ |
H A D | poll.c | 91 STATIC INT32 QueryFds(struct pollfd *fds, nfds_t nfds, struct PollTable *table) in QueryFds() argument 97 if (((nfds != 0) && (fds == NULL)) || (table == NULL)) { in QueryFds() 103 struct pollfd *tmpFds = &fds[i]; in QueryFds() 157 STATIC INLINE INT32 PollTimedWait(struct pollfd *fds, nfds_t nfds, struct PollTable *table, INT32 timeout) in PollTimedWait() argument 194 count = QueryFds(fds, nfds, table); in PollTimedWait() 200 int poll(struct pollfd *fds, nfds_t nfds, int timeout) in poll() argument 212 count = QueryFds(fds, nfds, &table); in poll() 223 count = PollTimedWait(fds, nfds, &table, timeout); in poll()
|
/kernel/linux/linux-5.10/tools/testing/vsock/ |
H A D | vsock_test.c | 207 int fds[MULTICONN_NFDS]; in test_stream_multiconn_client() local 211 fds[i] = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_multiconn_client() 212 if (fds[i] < 0) { in test_stream_multiconn_client() 220 recv_byte(fds[i], 1, 0); in test_stream_multiconn_client() 222 send_byte(fds[i], 1, 0); in test_stream_multiconn_client() 226 close(fds[i]); in test_stream_multiconn_client() 231 int fds[MULTICONN_NFDS]; in test_stream_multiconn_server() local 235 fds[i] = vsock_stream_accept(VMADDR_CID_ANY, 1234, NULL); in test_stream_multiconn_server() 236 if (fds[i] < 0) { in test_stream_multiconn_server() 244 send_byte(fds[ in test_stream_multiconn_server() [all...] |
/kernel/linux/linux-5.10/tools/perf/bench/ |
H A D | sched-messaging.c | 53 static void fdpair(int fds[2]) in fdpair() argument 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() 228 /* Now we have all the fds, for in group() [all...] |
/kernel/liteos_a/testsuites/unittest/net/socket/smoke/ |
H A D | net_socket_test_009.cpp | 54 static void GetReadfds(struct pollfd *fds, int *nfd) in GetReadfds() argument 60 fds[*nfd].fd = gFds[i]; in GetReadfds() 61 fds[*nfd].events = POLLIN; in GetReadfds() 138 static int HandleReadfds(struct pollfd *fds, int nfds, int lsfd) in HandleReadfds() argument 142 if (fds[i].revents == 0) { in HandleReadfds() 145 LogPrintln("[%d]revents: %04hx", fds[i].fd, fds[i].revents); in HandleReadfds() 146 if (fds[i].fd == lsfd) { in HandleReadfds() 149 ret += HandleRecv(fds[i].fd); in HandleReadfds()
|
/kernel/linux/linux-6.6/tools/testing/selftests/bpf/ |
H A D | network_helpers.c | 152 int *fds; in start_reuseport_server() local 160 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server() 161 if (!fds) in start_reuseport_server() 164 fds[0] = __start_server(type, 0, (struct sockaddr *)&addr, addrlen, in start_reuseport_server() 166 if (fds[0] == -1) in start_reuseport_server() 170 if (getsockname(fds[0], (struct sockaddr *)&addr, &addrlen)) in start_reuseport_server() 174 fds[nr_fds] = __start_server(type, 0, (struct sockaddr *)&addr, in start_reuseport_server() 176 if (fds[nr_fds] == -1) in start_reuseport_server() 180 return fds; in start_reuseport_server() 187 free_fds(int *fds, unsigned int nr_close_fds) free_fds() argument [all...] |