/system/bt/btif/src/ |
D | btif_sock_l2cap.cc | 89 static void btsock_l2cap_server_listen(l2cap_socket* sock); 115 static char packet_get_head_l(l2cap_socket* sock, uint8_t** data, in packet_get_head_l() argument 117 struct packet* p = sock->first_packet; in packet_get_head_l() 121 if (data) *data = sock->first_packet->data; in packet_get_head_l() 122 if (len) *len = sock->first_packet->len; in packet_get_head_l() 123 sock->first_packet = p->next; in packet_get_head_l() 124 if (sock->first_packet) in packet_get_head_l() 125 sock->first_packet->prev = NULL; in packet_get_head_l() 127 sock->last_packet = NULL; in packet_get_head_l() 129 if (len) sock->bytes_buffered -= *len; in packet_get_head_l() [all …]
|
/system/core/libstats/ |
D | statsd_writer.c | 65 .sock = -EBADF, 76 i = atomic_load(&statsdLoggerWrite.sock); in statsdOpen() 78 … int sock = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)); in statsdOpen() local 79 if (sock < 0) { in statsdOpen() 88 connect(sock, (struct sockaddr*)&un, sizeof(struct sockaddr_un))) < 0) { in statsdOpen() 94 i = atomic_exchange(&statsdLoggerWrite.sock, ret); in statsdOpen() 99 close(sock); in statsdOpen() 101 ret = atomic_exchange(&statsdLoggerWrite.sock, sock); in statsdOpen() 102 if ((ret >= 0) && (ret != sock)) { in statsdOpen() 114 int sock = atomic_exchange(&statsdLoggerWrite.sock, negative_errno); in __statsdClose() local [all …]
|
/system/core/liblog/ |
D | logd_writer.c | 53 .context.sock = -EBADF, 65 i = atomic_load(&logdLoggerWrite.context.sock); in logdOpen() 67 int sock = TEMP_FAILURE_RETRY( in logdOpen() local 69 if (sock < 0) { in logdOpen() 77 if (TEMP_FAILURE_RETRY(connect(sock, (struct sockaddr*)&un, in logdOpen() 84 i = atomic_exchange(&logdLoggerWrite.context.sock, ret); in logdOpen() 89 close(sock); in logdOpen() 91 ret = atomic_exchange(&logdLoggerWrite.context.sock, sock); in logdOpen() 92 if ((ret >= 0) && (ret != sock)) { in logdOpen() 104 int sock = atomic_exchange(&logdLoggerWrite.context.sock, negative_errno); in __logdClose() local [all …]
|
D | logd_reader.c | 264 int sock = socket_local_client("logd", ANDROID_SOCKET_NAMESPACE_RESERVED, in send_log_msg() local 266 if (sock < 0) { in send_log_msg() 267 return sock; in send_log_msg() 275 ret = TEMP_FAILURE_RETRY(write(sock, buf, len)); in send_log_msg() 282 while ((ret = TEMP_FAILURE_RETRY(read(sock, cp, len))) > 0) { in send_log_msg() 293 p.fd = sock; in send_log_msg() 317 close(sock); in send_log_msg() 468 int e, ret, remaining, sock; in logdOpen() local 474 sock = atomic_load(&transp->context.sock); in logdOpen() 475 if (sock > 0) { in logdOpen() [all …]
|
/system/core/libcutils/ |
D | socket_inaddr_any_server_windows.cpp | 42 SOCKET sock = socket(AF_INET6, type, 0); in socket_inaddr_any_server() local 43 if (sock == INVALID_SOCKET) { in socket_inaddr_any_server() 53 if (setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&exclusive, in socket_inaddr_any_server() 55 setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&v6_only, in socket_inaddr_any_server() 57 closesocket(sock); in socket_inaddr_any_server() 67 if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) { in socket_inaddr_any_server() 68 closesocket(sock); in socket_inaddr_any_server() 73 if (type == SOCK_STREAM && listen(sock, LISTEN_BACKLOG) == SOCKET_ERROR) { in socket_inaddr_any_server() 74 closesocket(sock); in socket_inaddr_any_server() 78 return sock; in socket_inaddr_any_server()
|
D | sockets_windows.cpp | 53 int socket_close(cutils_socket_t sock) { in socket_close() argument 54 return closesocket(sock); in socket_close() 57 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms) { in socket_set_receive_timeout() argument 58 return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, in socket_set_receive_timeout() 62 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument 80 if (WSASend(sock, wsa_buffers, num_buffers, &bytes_sent, 0, nullptr, in socket_send_buffers()
|
D | socket_network_client_windows.cpp | 54 SOCKET sock = socket(address->ai_family, address->ai_socktype, in socket_network_client() local 56 if (sock == INVALID_SOCKET) { in socket_network_client() 61 if (connect(sock, address->ai_addr, address->ai_addrlen) == SOCKET_ERROR) { in socket_network_client() 62 closesocket(sock); in socket_network_client() 68 return sock; in socket_network_client()
|
D | sockets_unix.cpp | 67 int socket_close(int sock) { in socket_close() argument 68 return close(sock); in socket_close() 71 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms) { in socket_set_receive_timeout() argument 75 return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); in socket_set_receive_timeout() 78 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument 94 return writev(sock, iovec_buffers, num_buffers); in socket_send_buffers()
|
/system/netd/server/ |
D | ndc.cpp | 35 static int do_monitor(int sock, int stop_after_cmd); 36 static int do_cmd(int sock, int argc, char **argv); 39 int sock; in main() local 47 if ((sock = socket_local_client(argv[1], in main() 50 if ((sock = socket_local_client("netd", in main() 63 exit(do_monitor(sock, 0)); in main() 64 exit(do_cmd(sock, argc-cmdOffset, &(argv[cmdOffset]))); in main() 67 static int do_cmd(int sock, int argc, char **argv) { in do_cmd() argument 106 if (write(sock, final_cmd, strlen(final_cmd) + 1) < 0) { in do_cmd() 114 return do_monitor(sock, 1); in do_cmd() [all …]
|
D | NetlinkManager.cpp | 67 NetlinkHandler *NetlinkManager::setupSocket(int *sock, int netlinkFamily, in setupSocket() argument 80 if ((*sock = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, netlinkFamily)) < 0) { in setupSocket() 88 if (setsockopt(*sock, SOL_SOCKET, SO_RCVBUFFORCE, &sz, sizeof(sz)) < 0 && in setupSocket() 89 setsockopt(*sock, SOL_SOCKET, SO_RCVBUF, &sz, sizeof(sz)) < 0) { in setupSocket() 91 close(*sock); in setupSocket() 95 if (setsockopt(*sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) { in setupSocket() 97 close(*sock); in setupSocket() 101 if (bind(*sock, (struct sockaddr *) &nladdr, sizeof(nladdr)) < 0) { in setupSocket() 103 close(*sock); in setupSocket() 108 if (android_nflog_send_config_cmd(*sock, 0, NFULNL_CFG_CMD_PF_UNBIND, AF_INET) < 0) { in setupSocket() [all …]
|
D | NetlinkCommands.cpp | 34 int sock = socket(AF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, protocol); in openNetlinkSocket() local 35 if (sock == -1) { in openNetlinkSocket() 38 if (connect(sock, reinterpret_cast<const sockaddr*>(&KERNEL_NLADDR), in openNetlinkSocket() 42 return sock; in openNetlinkSocket() 45 int recvNetlinkAck(int sock) { in recvNetlinkAck() argument 51 int ret = recv(sock, &response, sizeof(response), 0); in recvNetlinkAck() 88 int sock = openNetlinkSocket(NETLINK_ROUTE); in sendNetlinkRequest() local 89 if (sock < 0) { in sendNetlinkRequest() 90 return sock; in sendNetlinkRequest() 95 if (writev(sock, iov, iovlen) == -1) { in sendNetlinkRequest() [all …]
|
/system/netd/libnetdutils/include/netdutils/ |
D | Syscalls.h | 48 virtual Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const = 0; 50 virtual Status getsockopt(Fd sock, int level, int optname, void *optval, 53 virtual Status setsockopt(Fd sock, int level, int optname, const void* optval, 56 virtual Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0; 58 virtual Status connect(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0; 70 virtual StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const sockaddr* dst, 73 virtual StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags, sockaddr* src, 113 StatusOr<SockaddrT> getsockname(Fd sock) const { in getsockname() argument 116 RETURN_IF_NOT_OK(getsockname(sock, asSockaddrPtr(&addr), &addrlen)); in getsockname() 121 Status getsockopt(Fd sock, int level, int optname, void* optval, socklen_t* optlen) const { in getsockopt() argument [all …]
|
D | MockSyscalls.h | 39 MOCK_CONST_METHOD3(getsockname, Status(Fd sock, sockaddr* addr, socklen_t* addrlen)); 40 MOCK_CONST_METHOD5(getsockopt, Status(Fd sock, int level, int optname, void* optval, 42 MOCK_CONST_METHOD5(setsockopt, Status(Fd sock, int level, int optname, const void* optval, 45 MOCK_CONST_METHOD3(bind, Status(Fd sock, const sockaddr* addr, socklen_t addrlen)); 46 MOCK_CONST_METHOD3(connect, Status(Fd sock, const sockaddr* addr, socklen_t addrlen)); 55 MOCK_CONST_METHOD5(sendto, StatusOr<size_t>(Fd sock, const Slice buf, int flags, 57 MOCK_CONST_METHOD5(recvfrom, StatusOr<Slice>(Fd sock, const Slice dst, int flags, sockaddr* src,
|
/system/netd/libnetdutils/ |
D | SocketOption.cpp | 29 Status enableSockopt(Fd sock, int level, int optname) { in enableSockopt() argument 32 return sys.setsockopt(sock, level, optname, &on, sizeof(on)); in enableSockopt() 35 Status enableTcpKeepAlives(Fd sock, unsigned idleTime, unsigned numProbes, unsigned probeInterval) { in enableTcpKeepAlives() argument 36 RETURN_IF_NOT_OK(enableSockopt(sock, SOL_SOCKET, SO_KEEPALIVE)); in enableTcpKeepAlives() 40 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, &idleTime, sizeof(idleTime))); in enableTcpKeepAlives() 43 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPCNT, &numProbes, sizeof(numProbes))); in enableTcpKeepAlives() 46 RETURN_IF_NOT_OK(sys.setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, &probeInterval, in enableTcpKeepAlives()
|
D | Syscalls.cpp | 53 UniqueFd sock(::socket(domain, type, protocol)); in socket() local 54 if (!isWellFormed(sock)) { in socket() 57 return sock; in socket() 60 Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const override { in getsockname() argument 61 auto rv = ::getsockname(sock.get(), addr, addrlen); in getsockname() 68 Status getsockopt(Fd sock, int level, int optname, void* optval, in getsockopt() argument 70 auto rv = ::getsockopt(sock.get(), level, optname, optval, optlen); in getsockopt() 77 Status setsockopt(Fd sock, int level, int optname, const void* optval, in setsockopt() argument 79 auto rv = ::setsockopt(sock.get(), level, optname, optval, optlen); in setsockopt() 86 Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const override { in bind() argument [all …]
|
/system/core/fastboot/ |
D | socket.cpp | 34 Socket::Socket(cutils_socket_t sock) : sock_(sock) {} in Socket() argument 112 UdpSocket(Type type, cutils_socket_t sock); 125 UdpSocket::UdpSocket(Type type, cutils_socket_t sock) : Socket(sock) { in UdpSocket() argument 170 explicit TcpSocket(cutils_socket_t sock) : Socket(sock) {} in TcpSocket() argument 249 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_DGRAM); in NewClient() local 250 if (sock != INVALID_SOCKET) { in NewClient() 251 return std::unique_ptr<UdpSocket>(new UdpSocket(UdpSocket::Type::kClient, sock)); in NewClient() 254 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_STREAM); in NewClient() local 255 if (sock != INVALID_SOCKET) { in NewClient() 256 return std::unique_ptr<TcpSocket>(new TcpSocket(sock)); in NewClient() [all …]
|
D | socket_mock.cpp | 120 std::unique_ptr<Socket> sock = std::move(events_.front().sock); in Accept() local 122 return sock; in Accept() 145 void SocketMock::AddAccept(std::unique_ptr<Socket> sock) { in AddAccept() argument 146 events_.push(Event(EventType::kAccept, "", false, std::move(sock))); in AddAccept() 151 : type(_type), message(_message), status(_status), sock(std::move(_sock)) {} in Event()
|
/system/hardware/interfaces/net/netd/testutils/ |
D | VtsHalNetNetdTestUtils.cpp | 34 int sock = socket(AF_INET6, SOCK_STREAM, 0); in checkNetworkExists() local 35 if (sock == -1) { in checkNetworkExists() 38 int ret = android_setsocknetwork(netHandle, sock); in checkNetworkExists() 42 close(sock); in checkNetworkExists() 103 int sock = socket(ai->ai_family, SOCK_DGRAM, 0); in checkReachability() local 104 if (sock == -1 || android_setsocknetwork(netHandle, sock) == -1) { in checkReachability() 110 ret = connect(sock, ai->ai_addr, ai->ai_addrlen); in checkReachability() 111 close(sock); in checkReachability()
|
/system/core/libcutils/tests/ |
D | sockets_test.cpp | 78 void TestReceiveTimeout(cutils_socket_t sock) { in TestReceiveTimeout() argument 83 EXPECT_EQ(0, socket_set_receive_timeout(sock, 20)); in TestReceiveTimeout() 85 EXPECT_EQ(-1, recv(sock, buffer, sizeof(buffer), 0)); in TestReceiveTimeout() 89 EXPECT_EQ(0, socket_set_receive_timeout(sock, 1250)); in TestReceiveTimeout() 91 EXPECT_EQ(-1, recv(sock, buffer, sizeof(buffer), 0)); in TestReceiveTimeout() 162 cutils_socket_t sock = socket_inaddr_any_server(0, SOCK_DGRAM); in TEST() local 163 ASSERT_NE(INVALID_SOCKET, sock); in TEST() 165 TestReceiveTimeout(sock); in TEST() 167 EXPECT_EQ(0, socket_close(sock)); in TEST()
|
/system/core/libcutils/include/cutils/ |
D | sockets.h | 104 int socket_close(cutils_socket_t sock); 112 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms); 117 int socket_get_local_port(cutils_socket_t sock); 140 ssize_t socket_send_buffers(cutils_socket_t sock,
|
/system/core/libcutils/include_vndk/cutils/ |
D | sockets.h | 104 int socket_close(cutils_socket_t sock); 112 int socket_set_receive_timeout(cutils_socket_t sock, int timeout_ms); 117 int socket_get_local_port(cutils_socket_t sock); 140 ssize_t socket_send_buffers(cutils_socket_t sock,
|
/system/netd/tests/benchmarks/ |
D | connect_benchmark.cpp | 134 int sock = socket(AF_INET, SOCK_STREAM, 0); in ipv4_loopback() local 135 if (sock < 0) { in ipv4_loopback() 143 if (connect(sock, (sockaddr*) &server, sizeof(server))) { in ipv4_loopback() 145 close(sock); in ipv4_loopback() 161 close(sock); in ipv4_loopback() 166 close(sock); in ipv4_loopback() 191 int sock = socket(AF_INET6, SOCK_STREAM, 0); in ipv6_loopback() local 192 if (sock < 0) { in ipv6_loopback() 200 if (connect(sock, (sockaddr*) &server, sizeof(server))) { in ipv6_loopback() 202 close(sock); in ipv6_loopback() [all …]
|
/system/netd/tests/ |
D | bpf_base_test.cpp | 90 int sock = socket(AF_INET6, SOCK_STREAM, 0); in TEST_F() local 91 ASSERT_LE(0, sock); in TEST_F() 92 uint64_t cookie = getSocketCookie(sock); in TEST_F() 94 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F() 99 ASSERT_EQ(0, qtaguid_untagSocket(sock)); in TEST_F() 110 int sock = socket(AF_INET6, SOCK_STREAM, 0); in TEST_F() local 111 ASSERT_LE(0, sock); in TEST_F() 112 uint64_t cookie = getSocketCookie(sock); in TEST_F() 114 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F() 119 ASSERT_EQ(0, close(sock)); in TEST_F()
|
/system/bt/tools/hci/ |
D | main.c | 178 int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); in write_hci_command() local 179 if (sock == INVALID_FD) goto error; in write_hci_command() 186 OSI_NO_INTR(ret = connect(sock, (const struct sockaddr*)&addr, sizeof(addr))); in write_hci_command() 189 if (send(sock, &type, 1, 0) != 1) goto error; in write_hci_command() 191 if (send(sock, &length, 2, 0) != 2) goto error; in write_hci_command() 193 if (send(sock, packet, length, 0) != (ssize_t)length) goto error; in write_hci_command() 195 close(sock); in write_hci_command() 199 close(sock); in write_hci_command()
|
/system/core/libmemunreachable/ |
D | LeakPipe.cpp | 26 bool LeakPipe::SendFd(int sock, int fd) { in SendFd() argument 47 int ret = sendmsg(sock, &hdr, 0); in SendFd() 60 int LeakPipe::ReceiveFd(int sock) { in ReceiveFd() argument 74 int ret = recvmsg(sock, &hdr, 0); in ReceiveFd()
|