Home
last modified time | relevance | path

Searched refs:sock (Results 1 – 25 of 61) sorted by relevance

123

/system/core/libstats/push_compat/
Dstatsd_writer.cpp68 .sock = -EBADF,
80 i = atomic_load(&statsdLoggerWrite.sock); in statsdOpen()
89 int sock = TEMP_FAILURE_RETRY(socket(PF_UNIX, flags, 0)); in statsdOpen() local
90 if (sock < 0) { in statsdOpen()
97 setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, bufLen); in statsdOpen()
104 connect(sock, (struct sockaddr*)&un, sizeof(struct sockaddr_un))) < 0) { in statsdOpen()
110 i = atomic_exchange(&statsdLoggerWrite.sock, ret); in statsdOpen()
115 close(sock); in statsdOpen()
117 ret = atomic_exchange(&statsdLoggerWrite.sock, sock); in statsdOpen()
118 if ((ret >= 0) && (ret != sock)) { in statsdOpen()
[all …]
/system/core/libcutils/
Dsocket_inaddr_any_server_windows.cpp42 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()
Dsocket_network_client_windows.cpp54 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()
Dsockets_windows.cpp53 int socket_close(cutils_socket_t sock) { in socket_close() argument
54 return closesocket(sock); in socket_close()
57 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument
75 if (WSASend(sock, wsa_buffers, num_buffers, &bytes_sent, 0, nullptr, in socket_send_buffers()
Dsockets_unix.cpp30 int socket_close(int sock) { in socket_close() argument
31 return close(sock); in socket_close()
34 ssize_t socket_send_buffers(cutils_socket_t sock, in socket_send_buffers() argument
50 return writev(sock, iovec_buffers, num_buffers); in socket_send_buffers()
Dsockets.cpp34 int socket_get_local_port(cutils_socket_t sock) { in socket_get_local_port() argument
38 if (getsockname(sock, reinterpret_cast<sockaddr*>(&addr), &addr_size) == 0) { in socket_get_local_port()
/system/memory/lmkd/
Dliblmkd_utils.cpp35 int lmkd_register_proc(int sock, struct lmk_procprio *params) { in lmkd_register_proc() argument
41 ret = TEMP_FAILURE_RETRY(write(sock, packet, size)); in lmkd_register_proc()
46 int lmkd_register_procs(int sock, struct lmk_procs_prio* params, const int proc_count) { in lmkd_register_procs() argument
52 ret = TEMP_FAILURE_RETRY(write(sock, packet, size)); in lmkd_register_procs()
57 int lmkd_unregister_proc(int sock, struct lmk_procremove *params) { in lmkd_unregister_proc() argument
63 ret = TEMP_FAILURE_RETRY(write(sock, packet, size)); in lmkd_unregister_proc()
68 enum update_props_result lmkd_update_props(int sock) { in lmkd_update_props() argument
73 if (TEMP_FAILURE_RETRY(write(sock, packet, size)) < 0) { in lmkd_update_props()
77 size = TEMP_FAILURE_RETRY(read(sock, packet, CTRL_PACKET_MAX_SIZE)); in lmkd_update_props()
92 enum boot_completed_notification_result lmkd_notify_boot_completed(int sock) { in lmkd_notify_boot_completed() argument
[all …]
/system/netd/server/
DNetlinkCommands.cpp35 int sock = socket(AF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, protocol); in openNetlinkSocket() local
36 if (sock == -1) { in openNetlinkSocket()
39 if (connect(sock, reinterpret_cast<const sockaddr*>(&KERNEL_NLADDR), in openNetlinkSocket()
41 close(sock); in openNetlinkSocket()
44 return sock; in openNetlinkSocket()
47 int recvNetlinkAck(int sock) { in recvNetlinkAck() argument
53 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()
[all …]
DNetlinkManager.cpp67 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 …]
/system/logging/liblog/
Dlogd_reader.cpp88 int sock = socket_local_client("logd", SOCK_STREAM, true); in SendLogdControlMessage() local
89 if (sock < 0) { in SendLogdControlMessage()
90 return sock; in SendLogdControlMessage()
94 ret = TEMP_FAILURE_RETRY(write(sock, buf, len)); in SendLogdControlMessage()
101 while ((ret = TEMP_FAILURE_RETRY(read(sock, cp, len))) > 0) { in SendLogdControlMessage()
110 struct pollfd p = {.fd = sock, .events = POLLIN}; in SendLogdControlMessage()
131 close(sock); in SendLogdControlMessage()
280 int ret, remaining, sock; in logdOpen() local
283 sock = atomic_load(&logger_list->fd); in logdOpen()
284 if (sock > 0) { in logdOpen()
[all …]
Dlogd_writer.cpp64 int sock() { in sock() function in LogdSocket
74 static void LogdConnect(int sock) { in LogdConnect() argument
78 TEMP_FAILURE_RETRY(connect(sock, reinterpret_cast<sockaddr*>(&un), sizeof(sockaddr_un))); in LogdConnect()
130 if (logd_socket.sock() < 0) { in LogdWrite()
164 ret = TEMP_FAILURE_RETRY(writev(logd_socket.sock(), newVec, 2)); in LogdWrite()
187 ret = TEMP_FAILURE_RETRY(writev(logd_socket.sock(), newVec, i)); in LogdWrite()
191 ret = TEMP_FAILURE_RETRY(writev(logd_socket.sock(), newVec, i)); in LogdWrite()
/system/core/fastboot/
Dsocket.cpp38 Socket::Socket(cutils_socket_t sock) : sock_(sock) {} in Socket() argument
118 UdpSocket(Type type, cutils_socket_t sock);
131 UdpSocket::UdpSocket(Type type, cutils_socket_t sock) : Socket(sock) { in UdpSocket() argument
176 explicit TcpSocket(cutils_socket_t sock) : Socket(sock) {} in TcpSocket() argument
255 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_DGRAM); in NewClient() local
256 if (sock != INVALID_SOCKET) { in NewClient()
257 return std::unique_ptr<UdpSocket>(new UdpSocket(UdpSocket::Type::kClient, sock)); in NewClient()
260 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_STREAM); in NewClient() local
261 if (sock != INVALID_SOCKET) { in NewClient()
262 return std::unique_ptr<TcpSocket>(new TcpSocket(sock)); in NewClient()
[all …]
Dsocket_mock.cpp120 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()
Dsocket_test.cpp64 static bool SendString(Socket* sock, const std::string& message) { in SendString() argument
65 return sock->Send(message.c_str(), message.length()); in SendString()
70 static bool ReceiveString(Socket* sock, const std::string& message) { in ReceiveString() argument
72 ssize_t bytes = sock->ReceiveAll(&received[0], received.length(), kTestTimeoutMs); in ReceiveString()
175 std::unique_ptr<Socket> sock = Socket::NewServer(Socket::Protocol::kUdp, 0); in TEST() local
184 sock->socket_send_buffers_function_ = [&buffers, &mock_return_value]( in TEST()
196 EXPECT_TRUE(sock->Send(buffers)); in TEST()
199 EXPECT_FALSE(sock->Send(buffers)); in TEST()
202 EXPECT_FALSE(sock->Send(buffers)); in TEST()
205 EXPECT_FALSE(sock->Send(buffers)); in TEST()
[all …]
Dtcp.cpp70 explicit TcpTransport(std::unique_ptr<Socket> sock) : socket_(std::move(sock)) {} in TcpTransport() argument
193 std::unique_ptr<Transport> Connect(std::unique_ptr<Socket> sock, std::string* error) { in Connect() argument
194 if (sock == nullptr) { in Connect()
199 return TcpTransport::NewTransport(std::move(sock), error); in Connect()
/system/memory/lmkd/include/
Dliblmkd_utils.h40 int lmkd_register_proc(int sock, struct lmk_procprio *params);
48 int lmkd_register_procs(int sock, struct lmk_procs_prio* params, const int proc_count);
56 int lmkd_unregister_proc(int sock, struct lmk_procremove *params);
70 enum update_props_result lmkd_update_props(int sock);
94 enum boot_completed_notification_result lmkd_notify_boot_completed(int sock);
107 int lmkd_get_kill_count(int sock, struct lmk_getkillcnt* params);
/system/hardware/interfaces/net/netd/testutils/
DVtsHalNetNetdTestUtils.cpp34 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/netd/tests/benchmarks/
Dconnect_benchmark.cpp112 int sock = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); in ipv4_loopback() local
113 if (sock < 0) { in ipv4_loopback()
121 if (connect(sock, (sockaddr*) &server, sizeof(server))) { in ipv4_loopback()
123 close(sock); in ipv4_loopback()
139 close(sock); in ipv4_loopback()
144 close(sock); in ipv4_loopback()
169 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in ipv6_loopback() local
170 if (sock < 0) { in ipv6_loopback()
178 if (connect(sock, (sockaddr*) &server, sizeof(server))) { in ipv6_loopback()
180 close(sock); in ipv6_loopback()
[all …]
/system/libbase/include/android-base/
Dcmsg.h54 ssize_t SendFileDescriptorVector(borrowed_fd sock, const void* data, size_t len,
61 ssize_t ReceiveFileDescriptorVector(borrowed_fd sock, void* data, size_t len, size_t max_fds,
67 ssize_t SendFileDescriptors(borrowed_fd sock, const void* data, size_t len, Args&&... sent_fds) { in SendFileDescriptors() argument
74 return SendFileDescriptorVector(sock, data, len, fds); in SendFileDescriptors()
82 ssize_t ReceiveFileDescriptors(borrowed_fd sock, void* data, size_t len, Args&&... received_fds) { in ReceiveFileDescriptors() argument
87 ssize_t rc = ReceiveFileDescriptorVector(sock, data, len, fds.size(), &result); in ReceiveFileDescriptors()
/system/netd/tests/
Dnetd_client_test.cpp38 android::base::unique_fd sock(socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in checkNetworkConnectivity() local
39 if (sock == -1) return false; in checkNetworkConnectivity()
44 int ret = connect(sock, reinterpret_cast<const sockaddr*>(&server6), sizeof(server6)); in checkNetworkConnectivity()
46 sock.reset(socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in checkNetworkConnectivity()
47 if (sock == -1) return false; in checkNetworkConnectivity()
52 ret = connect(sock, reinterpret_cast<const sockaddr*>(&server4), sizeof(server4)); in checkNetworkConnectivity()
/system/logging/logd/
DLogListener.cpp127 int sock = android_get_control_socket(socketName); in GetLogSocket() local
129 if (sock < 0) { // logd started up in init.sh in GetLogSocket()
130 sock = socket_local_server( in GetLogSocket()
134 if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) { in GetLogSocket()
138 return sock; in GetLogSocket()
/system/core/fastboot/fuzzer/
Dsocket_mock_fuzz.cpp95 std::unique_ptr<Socket> sock = std::move(events_.front().sock); in Accept() local
97 return sock; in Accept()
120 void SocketMockFuzz::AddAccept(std::unique_ptr<Socket> sock) { in AddAccept() argument
121 events_.push(Event(EventType::kAccept, "", false, std::move(sock))); in AddAccept()
126 : type(_type), message(_message), status(_status), sock(std::move(_sock)) {} in Event()
/system/memory/libmemunreachable/
DLeakPipe.cpp26 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()
/system/core/libcutils/include/cutils/
Dsockets.h103 int socket_close(cutils_socket_t sock);
108 int socket_get_local_port(cutils_socket_t sock);
131 ssize_t socket_send_buffers(cutils_socket_t sock,
/system/core/libcutils/include_outside_system/cutils/
Dsockets.h103 int socket_close(cutils_socket_t sock);
108 int socket_get_local_port(cutils_socket_t sock);
131 ssize_t socket_send_buffers(cutils_socket_t sock,

123