/openbmc/linux/tools/testing/selftests/net/ |
H A D | bind_bhash.c | 33 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 …]
|
/openbmc/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | sockopt_multi.c | 8 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 …]
|
H A D | cgroup_getset_retval.c | 19 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 …]
|
H A D | sockopt_qos_to_cc.c | 7 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()
|
H A D | probe_user.c | 16 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()
|
H A D | connect_ping.c | 34 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()
|
H A D | sockmap_basic.c | 197 __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 …]
|
H A D | bpf_iter.c | 1123 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 …]
|
H A D | sockopt.c | 945 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()
|
H A D | assign_reuse.c | 16 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()
|
H A D | xdp_metadata.c | 293 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()
|
/openbmc/qemu/contrib/ivshmem-server/ |
H A D | ivshmem-server.c | 32 ivshmem_server_send_one_msg(int sock_fd, int64_t peer_id, int fd) in ivshmem_server_send_one_msg() argument 63 ret = sendmsg(sock_fd, &msg, 0); in ivshmem_server_send_one_msg() 80 close(peer->sock_fd); in ivshmem_server_free_peer() 85 ivshmem_server_send_one_msg(other_peer->sock_fd, peer->id, -1); in ivshmem_server_free_peer() 102 ret = ivshmem_server_send_one_msg(peer->sock_fd, IVSHMEM_PROTOCOL_VERSION, in ivshmem_server_send_initial_info() 111 ret = ivshmem_server_send_one_msg(peer->sock_fd, peer->id, -1); in ivshmem_server_send_initial_info() 119 ret = ivshmem_server_send_one_msg(peer->sock_fd, -1, server->shm_fd); in ivshmem_server_send_initial_info() 141 newfd = qemu_accept(server->sock_fd, in ivshmem_server_handle_new_conn() 154 peer->sock_fd = newfd; in ivshmem_server_handle_new_conn() 191 ivshmem_server_send_one_msg(other_peer->sock_fd, peer->id, in ivshmem_server_handle_new_conn() [all …]
|
H A D | ivshmem-server.h | 50 int sock_fd; /**< connected unix sock */ member 64 int sock_fd; /**< unix sock file descriptor */ member
|
/openbmc/qemu/tests/qtest/ |
H A D | stm32l4x5_usart-test.c | 88 static void usart_receive_string(QTestState *qts, int sock_fd, const char *in, in usart_receive_string() argument 93 g_assert_true(send(sock_fd, in, in_len, 0) == in_len); in usart_receive_string() 214 int sock_fd; in test_receive_char() local 216 QTestState *qts = qtest_init_with_serial("-M b-l475e-iot01a", &sock_fd); in test_receive_char() 221 g_assert_true(send(sock_fd, "a", 1, 0) == 1); in test_receive_char() 230 g_assert_true(send(sock_fd, "b", 1, 0) == 1); in test_receive_char() 236 close(sock_fd); in test_receive_char() 243 int sock_fd; in test_send_char() local 246 QTestState *qts = qtest_init_with_serial("-M b-l475e-iot01a", &sock_fd); in test_send_char() 252 g_assert_true(recv(sock_fd, s, 1, 0) == 1); in test_send_char() [all …]
|
H A D | microbit-test.c | 49 static void uart_rw_to_rxd(QTestState *qts, int sock_fd, const char *in, in uart_rw_to_rxd() argument 54 g_assert_true(send(sock_fd, in, in_len, 0) == in_len); in uart_rw_to_rxd() 76 int sock_fd; in test_nrf51_uart() local 78 QTestState *qts = qtest_init_with_serial("-M microbit", &sock_fd); in test_nrf51_uart() 80 g_assert_true(send(sock_fd, "c", 1, 0) == 1); in test_nrf51_uart() 95 uart_rw_to_rxd(qts, sock_fd, "hello", s); in test_nrf51_uart() 100 g_assert_true(recv(sock_fd, s, 10, 0) == 1); in test_nrf51_uart() 107 g_assert_true(recv(sock_fd, s, 10, 0) == 5); in test_nrf51_uart() 110 close(sock_fd); in test_nrf51_uart()
|
/openbmc/qemu/contrib/ivshmem-client/ |
H A D | ivshmem-client.c | 46 ret = recvmsg(client->sock_fd, &msg, 0); in ivshmem_client_read_one_msg() 172 client->sock_fd = -1; in ivshmem_client_init() 188 client->sock_fd = socket(AF_UNIX, SOCK_STREAM, 0); in ivshmem_client_connect() 189 if (client->sock_fd < 0) { in ivshmem_client_connect() 203 if (connect(client->sock_fd, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) { in ivshmem_client_connect() 240 close(client->sock_fd); in ivshmem_client_connect() 241 client->sock_fd = -1; in ivshmem_client_connect() 260 close(client->sock_fd); in ivshmem_client_close() 261 client->sock_fd = -1; in ivshmem_client_close() 277 FD_SET(client->sock_fd, fds); in ivshmem_client_get_fds() [all …]
|
/openbmc/linux/arch/um/drivers/ |
H A D | port_user.c | 151 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()
|
/openbmc/qemu/python/qemu/machine/ |
H A D | console_socket.py | 36 sock_fd: Optional[int] = None, 39 if address is None and sock_fd is None: 41 if address is not None and sock_fd is not None: 51 assert sock_fd is not None 52 socket.socket.__init__(self, fileno=sock_fd)
|
/openbmc/linux/drivers/infiniband/hw/usnic/ |
H A D | usnic_transport.c | 144 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()
|
H A D | usnic_ib_qp_grp.c | 266 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()
|
H A D | usnic_transport.h | 57 struct socket *usnic_transport_get_socket(int sock_fd);
|
H A D | usnic_abi.h | 59 uint32_t sock_fd; member
|
/openbmc/qemu/contrib/vhost-user-gpu/ |
H A D | vhost-user-gpu.c | 113 if (g->sock_fd >= 0) { in vg_sock_fd_close() 114 close(g->sock_fd); in vg_sock_fd_close() 115 g->sock_fd = -1; in vg_sock_fd_close() 139 g->wait_in = g_unix_fd_add(g->sock_fd, G_IO_IN | G_IO_HUP, in vg_wait_ok() 184 if (vg_sock_fd_write(vg->sock_fd, msg, in vg_send_msg() 196 if (vg_sock_fd_read(g->sock_fd, &req, sizeof(req)) < 0 || in vg_recv_msg() 197 vg_sock_fd_read(g->sock_fd, &flags, sizeof(flags)) < 0 || in vg_recv_msg() 198 vg_sock_fd_read(g->sock_fd, &size, sizeof(size)) < 0) { in vg_recv_msg() 206 if (size && vg_sock_fd_read(g->sock_fd, payload, size) != size) { in vg_recv_msg() 301 vg->wait_in = g_unix_fd_add(vg->sock_fd, G_IO_IN | G_IO_HUP, in vg_get_display_info() [all …]
|
/openbmc/linux/tools/testing/selftests/bpf/ |
H A D | test_progs.c | 1122 int sock_fd; member 1125 static int read_prog_test_msg(int sock_fd, struct msg *msg, enum msg_type type) in read_prog_test_msg() argument 1127 if (recv_message(sock_fd, msg) < 0) in read_prog_test_msg() 1138 static int dispatch_thread_read_log(int sock_fd, char **log_buf, size_t *log_cnt) in dispatch_thread_read_log() argument 1150 if (read_prog_test_msg(sock_fd, &msg, MSG_TEST_LOG)) { in dispatch_thread_read_log() 1166 static int dispatch_thread_send_subtests(int sock_fd, struct test_state *state) in dispatch_thread_send_subtests() argument 1179 if (read_prog_test_msg(sock_fd, &msg, MSG_SUBTEST_DONE)) in dispatch_thread_send_subtests() 1189 if (dispatch_thread_read_log(sock_fd, in dispatch_thread_send_subtests() 1201 int sock_fd; in dispatch_thread() local 1203 sock_fd = data->sock_fd; in dispatch_thread() [all …]
|
/openbmc/linux/tools/perf/ |
H A D | builtin-daemon.c | 809 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()
|