Home
last modified time | relevance | path

Searched refs:sock_fd (Results 1 – 23 of 23) sorted by relevance

/linux-6.6.21/tools/testing/selftests/net/
Dbind_bhash.c33 int sock_fd, reuse = 1, err; in bind_socket() local
36 sock_fd = socket(domain, SOCK_STREAM, 0); in bind_socket()
37 if (sock_fd < 0) { in bind_socket()
39 return sock_fd; in bind_socket()
52 err = setsockopt(sock_fd, SOL_SOCKET, opt, &reuse, sizeof(reuse)); in bind_socket()
59 err = bind(sock_fd, res->ai_addr, res->ai_addrlen); in bind_socket()
65 return sock_fd; in bind_socket()
68 close(sock_fd); in bind_socket()
74 int sock_fd, i; in setup() local
78 sock_fd = bind_socket(SO_REUSEADDR | SO_REUSEPORT, setup_addr); in setup()
[all …]
/linux-6.6.21/tools/testing/selftests/bpf/prog_tests/
Dsockopt_multi.c8 int cg_child, int sock_fd) in run_getsockopt_test() argument
19 err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1); in run_getsockopt_test()
27 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
51 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
76 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
95 err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1); in run_getsockopt_test()
103 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
119 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
131 err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1); in run_getsockopt_test()
139 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test()
[all …]
Dcgroup_getset_retval.c19 static void test_setsockopt_set(int cgroup_fd, int sock_fd) in test_setsockopt_set() argument
38 if (!ASSERT_ERR(setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, in test_setsockopt_set()
55 static void test_setsockopt_set_and_get(int cgroup_fd, int sock_fd) in test_setsockopt_set_and_get() argument
78 if (!ASSERT_ERR(setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, in test_setsockopt_set_and_get()
98 static void test_setsockopt_default_zero(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero() argument
117 if (!ASSERT_OK(setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, in test_setsockopt_default_zero()
134 static void test_setsockopt_default_zero_and_set(int cgroup_fd, int sock_fd) in test_setsockopt_default_zero_and_set() argument
158 if (!ASSERT_ERR(setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, in test_setsockopt_default_zero_and_set()
178 static void test_setsockopt_override(int cgroup_fd, int sock_fd) in test_setsockopt_override() argument
207 if (!ASSERT_ERR(setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, in test_setsockopt_override()
[all …]
Dsockopt_qos_to_cc.c7 static void run_setsockopt_test(int cg_fd, int sock_fd) in run_setsockopt_test() argument
15 err = setsockopt(sock_fd, SOL_IPV6, IPV6_TCLASS, &buf, sizeof(buf)); in run_setsockopt_test()
21 err = getsockopt(sock_fd, SOL_TCP, TCP_CONGESTION, cc, &optlen); in run_setsockopt_test()
34 int sock_fd = -1; in test_sockopt_qos_to_cc() local
47 sock_fd = socket(AF_INET6, SOCK_STREAM, 0); in test_sockopt_qos_to_cc()
48 if (!ASSERT_GE(sock_fd, 0, "v6 socket open")) in test_sockopt_qos_to_cc()
51 err = setsockopt(sock_fd, SOL_TCP, TCP_CONGESTION, &cc_cubic, in test_sockopt_qos_to_cc()
63 run_setsockopt_test(cg_fd, sock_fd); in test_sockopt_qos_to_cc()
66 if (sock_fd != -1) in test_sockopt_qos_to_cc()
67 close(sock_fd); in test_sockopt_qos_to_cc()
Dprobe_user.c16 int err, results_map_fd, sock_fd, duration = 0; in serial_test_probe_user() local
58 sock_fd = socket(AF_INET, SOCK_STREAM, 0); in serial_test_probe_user()
59 if (CHECK(sock_fd < 0, "create_sock_fd", "err %d\n", sock_fd)) in serial_test_probe_user()
62 connect(sock_fd, &curr, sizeof(curr)); in serial_test_probe_user()
63 close(sock_fd); in serial_test_probe_user()
Dconnect_ping.c34 int sock_fd; in subtest() local
52 sock_fd = socket(family, SOCK_DGRAM, protocol); in subtest()
53 if (!ASSERT_GE(sock_fd, 0, "sock-create")) in subtest()
56 if (!ASSERT_OK(connect(sock_fd, sa, sa_len), "connect")) in subtest()
68 if (!ASSERT_OK(getsockname(sock_fd, sa, &sa_len), in subtest()
93 close(sock_fd); in subtest()
Dsockmap_basic.c197 __s64 *sock_fd = NULL; in test_sockmap_copy() local
216 sock_fd = calloc(num_sockets, sizeof(*sock_fd)); in test_sockmap_copy()
217 if (!ASSERT_OK_PTR(sock_fd, "calloc(sock_fd)")) in test_sockmap_copy()
221 sock_fd[i] = -1; in test_sockmap_copy()
226 sock_fd[i] = connected_socket_v4(); in test_sockmap_copy()
227 if (!ASSERT_NEQ(sock_fd[i], -1, "connected_socket_v4")) in test_sockmap_copy()
230 err = bpf_map_update_elem(src_fd, &i, &sock_fd[i], BPF_NOEXIST); in test_sockmap_copy()
266 for (i = 0; sock_fd && i < num_sockets; i++) in test_sockmap_copy()
267 if (sock_fd[i] >= 0) in test_sockmap_copy()
268 close(sock_fd[i]); in test_sockmap_copy()
[all …]
Dbpf_iter.c1123 int sock_fd = -1; in test_bpf_sk_storage_delete() local
1133 sock_fd = socket(AF_INET6, SOCK_STREAM, 0); in test_bpf_sk_storage_delete()
1134 if (!ASSERT_GE(sock_fd, 0, "socket")) in test_bpf_sk_storage_delete()
1136 err = bpf_map_update_elem(map_fd, &sock_fd, &val, BPF_NOEXIST); in test_bpf_sk_storage_delete()
1160 err = bpf_map_lookup_elem(map_fd, &sock_fd, &val); in test_bpf_sk_storage_delete()
1170 if (sock_fd >= 0) in test_bpf_sk_storage_delete()
1171 close(sock_fd); in test_bpf_sk_storage_delete()
1185 int sock_fd = -1; in test_bpf_sk_storage_get() local
1191 sock_fd = socket(AF_INET6, SOCK_STREAM, 0); in test_bpf_sk_storage_get()
1192 if (!ASSERT_GE(sock_fd, 0, "socket")) in test_bpf_sk_storage_get()
[all …]
Dsockopt.c945 int sock_fd, err, prog_fd; in run_test() local
968 sock_fd = socket(AF_INET, SOCK_STREAM, 0); in run_test()
969 if (sock_fd < 0) { in run_test()
983 err = setsockopt(sock_fd, test->set_level, test->set_optname, in run_test()
1011 err = getsockopt(sock_fd, test->get_level, test->get_optname, in run_test()
1046 close(sock_fd); in run_test()
Dassign_reuse.c16 static int attach_reuseport(int sock_fd, int prog_fd) in attach_reuseport() argument
18 return setsockopt(sock_fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_EBPF, in attach_reuseport()
Dxdp_metadata.c293 int sock_fd; in test_xdp_metadata() local
352 sock_fd = xsk_socket__fd(rx_xsk.socket); in test_xdp_metadata()
353 ret = bpf_map_update_elem(bpf_map__fd(bpf_obj->maps.xsk), &queue_id, &sock_fd, 0); in test_xdp_metadata()
Dsk_lookup.c87 static int attach_reuseport(int sock_fd, struct bpf_program *reuseport_prog) in attach_reuseport() argument
97 err = setsockopt(sock_fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_EBPF, in attach_reuseport()
493 static int update_lookup_map(struct bpf_map *map, int index, int sock_fd) in update_lookup_map() argument
505 value = (uint64_t)sock_fd; in update_lookup_map()
/linux-6.6.21/arch/um/drivers/
Dport_user.c151 int sock_fd; member
159 dup2(data->sock_fd, 0); in port_pre_exec()
160 dup2(data->sock_fd, 1); in port_pre_exec()
161 dup2(data->sock_fd, 2); in port_pre_exec()
162 close(data->sock_fd); in port_pre_exec()
199 { .sock_fd = new, in port_connection()
/linux-6.6.21/drivers/infiniband/hw/usnic/
Dusnic_transport.c144 struct socket *usnic_transport_get_socket(int sock_fd) in usnic_transport_get_socket() argument
151 sock = sockfd_lookup(sock_fd, &err); in usnic_transport_get_socket()
154 sock_fd, err); in usnic_transport_get_socket()
Dusnic_ib_qp_grp.c266 int sock_fd; in create_udp_flow() local
278 sock_fd = trans_spec->udp.sock_fd; in create_udp_flow()
281 sock = usnic_transport_get_socket(sock_fd); in create_udp_flow()
290 usnic_err("Protocol for fd %d is not UDP", sock_fd); in create_udp_flow()
Dusnic_transport.h57 struct socket *usnic_transport_get_socket(int sock_fd);
Dusnic_abi.h59 uint32_t sock_fd; member
/linux-6.6.21/tools/testing/selftests/bpf/
Dtest_progs.c1108 int sock_fd; member
1111 static int read_prog_test_msg(int sock_fd, struct msg *msg, enum msg_type type) in read_prog_test_msg() argument
1113 if (recv_message(sock_fd, msg) < 0) in read_prog_test_msg()
1124 static int dispatch_thread_read_log(int sock_fd, char **log_buf, size_t *log_cnt) in dispatch_thread_read_log() argument
1136 if (read_prog_test_msg(sock_fd, &msg, MSG_TEST_LOG)) { in dispatch_thread_read_log()
1152 static int dispatch_thread_send_subtests(int sock_fd, struct test_state *state) in dispatch_thread_send_subtests() argument
1165 if (read_prog_test_msg(sock_fd, &msg, MSG_SUBTEST_DONE)) in dispatch_thread_send_subtests()
1175 if (dispatch_thread_read_log(sock_fd, in dispatch_thread_send_subtests()
1187 int sock_fd; in dispatch_thread() local
1189 sock_fd = data->sock_fd; in dispatch_thread()
[all …]
Dxdp_hw_metadata.c466 int sock_fd = xsk_socket__fd(rx_xsk[i].socket); in main() local
469 printf("map[%d] = %d\n", queue_id, sock_fd); in main()
470 ret = bpf_map_update_elem(bpf_map__fd(bpf_obj->maps.xsk), &queue_id, &sock_fd, 0); in main()
Dnetwork_helpers.h62 int get_socket_local_port(int sock_fd);
Dnetwork_helpers.c444 int get_socket_local_port(int sock_fd) in get_socket_local_port() argument
450 err = getsockname(sock_fd, (struct sockaddr *)&addr, &addrlen); in get_socket_local_port()
Dxsk.c447 int map_fd, sock_fd; in xsk_update_xskmap() local
451 sock_fd = xsk_socket__fd(xsk); in xsk_update_xskmap()
453 return bpf_map_update_elem(map_fd, &index, &sock_fd, 0); in xsk_update_xskmap()
/linux-6.6.21/tools/perf/
Dbuiltin-daemon.c809 static int handle_server_socket(struct daemon *daemon, int sock_fd) in handle_server_socket() argument
815 fd = accept(sock_fd, NULL, NULL); in handle_server_socket()
1255 int sock_fd = -1, conf_fd = -1, signal_fd = -1; in __cmd_start() local
1295 sock_fd = setup_server_socket(daemon); in __cmd_start()
1296 if (sock_fd < 0) in __cmd_start()
1307 sock_pos = fdarray__add(&fda, sock_fd, POLLIN|POLLERR|POLLHUP, 0); in __cmd_start()
1330 err = handle_server_socket(daemon, sock_fd); in __cmd_start()
1347 if (sock_fd != -1) in __cmd_start()
1348 close(sock_fd); in __cmd_start()