Home
last modified time | relevance | path

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

123

/system/bt/btif/src/
Dbtif_sock_l2cap.cc95 static void btsock_l2cap_server_listen(l2cap_socket* sock);
122 static char packet_get_head_l(l2cap_socket* sock, uint8_t** data, in packet_get_head_l() argument
124 struct packet* p = sock->first_packet; in packet_get_head_l()
128 if (data) *data = sock->first_packet->data; in packet_get_head_l()
129 if (len) *len = sock->first_packet->len; in packet_get_head_l()
130 sock->first_packet = p->next; in packet_get_head_l()
131 if (sock->first_packet) in packet_get_head_l()
132 sock->first_packet->prev = NULL; in packet_get_head_l()
134 sock->last_packet = NULL; in packet_get_head_l()
136 if (len) sock->bytes_buffered -= *len; in packet_get_head_l()
[all …]
/system/core/libstats/socket/
Dstatsd_writer.c68 .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/libstats/push_compat/
Dstatsd_writer.c68 .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()
/system/netd/libnetdutils/include/netdutils/
DSyscalls.h50 virtual Status getsockname(Fd sock, sockaddr* addr, socklen_t* addrlen) const = 0;
52 virtual Status getsockopt(Fd sock, int level, int optname, void *optval,
55 virtual Status setsockopt(Fd sock, int level, int optname, const void* optval,
58 virtual Status bind(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0;
60 virtual Status connect(Fd sock, const sockaddr* addr, socklen_t addrlen) const = 0;
62 virtual StatusOr<ifreq> ioctl(Fd sock, unsigned long request, ifreq* ifr) const = 0;
74 virtual StatusOr<size_t> sendto(Fd sock, const Slice buf, int flags, const sockaddr* dst,
77 virtual StatusOr<Slice> recvfrom(Fd sock, const Slice dst, int flags, sockaddr* src,
117 StatusOr<SockaddrT> getsockname(Fd sock) const { in getsockname() argument
120 RETURN_IF_NOT_OK(getsockname(sock, asSockaddrPtr(&addr), &addrlen)); in getsockname()
[all …]
DMockSyscalls.h39 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));
47 MOCK_CONST_METHOD3(ioctl, StatusOr<ifreq>(Fd sock, unsigned long request, ifreq* ifr));
56 MOCK_CONST_METHOD5(sendto, StatusOr<size_t>(Fd sock, const Slice buf, int flags,
58 MOCK_CONST_METHOD5(recvfrom, StatusOr<Slice>(Fd sock, const Slice dst, int flags, sockaddr* src,
/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()
43 return sock; in openNetlinkSocket()
46 int recvNetlinkAck(int sock) { in recvNetlinkAck() argument
52 int ret = recv(sock, &response, sizeof(response), 0); in recvNetlinkAck()
97 int sock = openNetlinkSocket(NETLINK_ROUTE); in sendNetlinkRequest() local
98 if (sock < 0) { in sendNetlinkRequest()
99 return sock; in sendNetlinkRequest()
104 if (writev(sock, iov, iovlen) == -1) { 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/netd/libnetdutils/
DSocketOption.cpp29 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()
DSyscalls.cpp53 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/liblog/
Dlogd_reader.cpp72 int sock = socket_local_client("logd", SOCK_STREAM); in SendLogdControlMessage() local
73 if (sock < 0) { in SendLogdControlMessage()
74 return sock; in SendLogdControlMessage()
78 ret = TEMP_FAILURE_RETRY(write(sock, buf, len)); in SendLogdControlMessage()
85 while ((ret = TEMP_FAILURE_RETRY(read(sock, cp, len))) > 0) { in SendLogdControlMessage()
96 p.fd = sock; in SendLogdControlMessage()
120 close(sock); in SendLogdControlMessage()
264 int ret, remaining, sock; in logdOpen() local
266 sock = atomic_load(&logger_list->fd); in logdOpen()
267 if (sock > 0) { in logdOpen()
[all …]
/system/core/fastboot/
Dsocket.cpp34 Socket::Socket(cutils_socket_t sock) : sock_(sock) {} in Socket() argument
114 UdpSocket(Type type, cutils_socket_t sock);
127 UdpSocket::UdpSocket(Type type, cutils_socket_t sock) : Socket(sock) { in UdpSocket() argument
172 explicit TcpSocket(cutils_socket_t sock) : Socket(sock) {} in TcpSocket() argument
251 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_DGRAM); in NewClient() local
252 if (sock != INVALID_SOCKET) { in NewClient()
253 return std::unique_ptr<UdpSocket>(new UdpSocket(UdpSocket::Type::kClient, sock)); in NewClient()
256 cutils_socket_t sock = socket_network_client(host.c_str(), port, SOCK_STREAM); in NewClient() local
257 if (sock != INVALID_SOCKET) { in NewClient()
258 return std::unique_ptr<TcpSocket>(new TcpSocket(sock)); in NewClient()
[all …]
/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/memory/lmkd/
Dliblmkd_utils.cpp34 int lmkd_register_proc(int sock, struct lmk_procprio *params) { in lmkd_register_proc() argument
40 ret = TEMP_FAILURE_RETRY(write(sock, packet, size)); in lmkd_register_proc()
45 int lmkd_unregister_proc(int sock, struct lmk_procremove *params) { in lmkd_unregister_proc() argument
51 ret = TEMP_FAILURE_RETRY(write(sock, packet, size)); in lmkd_unregister_proc()
56 enum update_props_result lmkd_update_props(int sock) { in lmkd_update_props() argument
61 if (TEMP_FAILURE_RETRY(write(sock, packet, size)) < 0) { in lmkd_update_props()
65 size = TEMP_FAILURE_RETRY(read(sock, packet, CTRL_PACKET_MAX_SIZE)); in lmkd_update_props()
/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.cpp41 android::base::unique_fd sock(socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in checkNetworkConnectivity() local
42 if (sock == -1) return false; in checkNetworkConnectivity()
47 int ret = connect(sock, reinterpret_cast<const sockaddr*>(&server6), sizeof(server6)); in checkNetworkConnectivity()
49 sock.reset(socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, IPPROTO_UDP)); in checkNetworkConnectivity()
50 if (sock == -1) return false; in checkNetworkConnectivity()
55 ret = connect(sock, reinterpret_cast<const sockaddr*>(&server4), sizeof(server4)); in checkNetworkConnectivity()
Dbpf_base_test.cpp104 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in TEST_F() local
105 ASSERT_LE(0, sock); in TEST_F()
106 uint64_t cookie = getSocketCookie(sock); in TEST_F()
108 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F()
113 ASSERT_EQ(0, qtaguid_untagSocket(sock)); in TEST_F()
124 int sock = socket(AF_INET6, SOCK_STREAM | SOCK_CLOEXEC, 0); in TEST_F() local
125 ASSERT_LE(0, sock); in TEST_F()
126 uint64_t cookie = getSocketCookie(sock); in TEST_F()
128 ASSERT_EQ(0, qtaguid_tagSocket(sock, TEST_TAG, TEST_UID)); in TEST_F()
133 ASSERT_EQ(0, close(sock)); in TEST_F()
/system/memory/lmkd/include/
Dliblmkd_utils.h40 int lmkd_register_proc(int sock, struct lmk_procprio *params);
48 int lmkd_unregister_proc(int sock, struct lmk_procremove *params);
62 enum update_props_result lmkd_update_props(int sock);
/system/bt/tools/hci/
Dmain.c179 int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); in write_hci_command() local
180 if (sock == INVALID_FD) goto error; in write_hci_command()
187 OSI_NO_INTR(ret = connect(sock, (const struct sockaddr*)&addr, sizeof(addr))); in write_hci_command()
190 if (send(sock, &type, 1, 0) != 1) goto error; in write_hci_command()
192 if (send(sock, &length, 2, 0) != 2) goto error; in write_hci_command()
194 if (send(sock, packet, length, 0) != (ssize_t)length) goto error; in write_hci_command()
196 close(sock); in write_hci_command()
200 close(sock); in write_hci_command()
/system/core/logd/
DLogListener.cpp125 int sock = android_get_control_socket(socketName); in GetLogSocket() local
127 if (sock < 0) { // logd started up in init.sh in GetLogSocket()
128 sock = socket_local_server( in GetLogSocket()
132 if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) { in GetLogSocket()
136 return sock; in GetLogSocket()
/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()

123