Loading libs/binder/FdTrigger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,11 @@ #include <poll.h> #include <android-base/macros.h> #include <android-base/scopeguard.h> #include "RpcState.h" #include "Utils.h" namespace android { std::unique_ptr<FdTrigger> FdTrigger::make() { Loading Loading @@ -77,7 +78,7 @@ status_t FdTrigger::triggerablePoll(const android::RpcTransportFd& transportFd, auto pollingStateGuard = android::base::make_scope_guard([&]() { transportFd.setPollingState(false); }); int ret = TEMP_FAILURE_RETRY(poll(pfd, arraysize(pfd), -1)); int ret = TEMP_FAILURE_RETRY(poll(pfd, countof(pfd), -1)); if (ret < 0) { return -errno; } Loading libs/binder/IPCThreadState.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <binder/BpBinder.h> #include <binder/TextOutput.h> #include <android-base/macros.h> #include <cutils/sched_policy.h> #include <utils/CallStack.h> #include <utils/Log.h> Loading Loading @@ -395,7 +394,9 @@ void IPCThreadState::restoreGetCallingSpGuard(const SpGuard* guard) { } void IPCThreadState::checkContextIsBinderForUse(const char* use) const { if (LIKELY(mServingStackPointerGuard == nullptr)) return; if (mServingStackPointerGuard == nullptr) [[likely]] { return; } if (!mServingStackPointer || mServingStackPointerGuard->address < mServingStackPointer) { LOG_ALWAYS_FATAL("In context %s, %s does not make sense (binder sp: %p, guard: %p).", Loading Loading @@ -832,7 +833,7 @@ status_t IPCThreadState::transact(int32_t handle, } if ((flags & TF_ONE_WAY) == 0) { if (UNLIKELY(mCallRestriction != ProcessState::CallRestriction::NONE)) { if (mCallRestriction != ProcessState::CallRestriction::NONE) [[unlikely]] { if (mCallRestriction == ProcessState::CallRestriction::ERROR_IF_NOT_ONEWAY) { ALOGE("Process making non-oneway call (code: %u) but is restricted.", code); CallStack::logStack("non-oneway call", CallStack::getCurrent(10).get(), Loading libs/binder/RpcSession.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <string_view> #include <android-base/macros.h> #include <android-base/scopeguard.h> #include <binder/BpBinder.h> #include <binder/Parcel.h> Loading Loading @@ -411,7 +410,9 @@ public: } private: DISALLOW_COPY_AND_ASSIGN(JavaThreadAttacher); JavaThreadAttacher(const JavaThreadAttacher&) = delete; void operator=(const JavaThreadAttacher&) = delete; bool mAttached = false; static JavaVM* getJavaVM() { Loading libs/binder/RpcState.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #include "RpcState.h" #include <android-base/macros.h> #include <android-base/scopeguard.h> #include <binder/BpBinder.h> #include <binder/IPCThreadState.h> Loading Loading @@ -601,7 +600,7 @@ status_t RpcState::transactAddress(const sp<RpcSession::RpcConnection>& connecti objectTableSpan.toIovec(), }; if (status_t status = rpcSend( connection, session, "transaction", iovs, arraysize(iovs), connection, session, "transaction", iovs, countof(iovs), [&] { if (waitUs > kWaitLogUs) { ALOGE("Cannot send command, trying to process pending refcounts. Waiting " Loading Loading @@ -690,7 +689,7 @@ status_t RpcState::waitForReply(const sp<RpcSession::RpcConnection>& connection, {&rpcReply, rpcReplyWireSize}, {data.data(), data.size()}, }; if (status_t status = rpcRec(connection, session, "reply body", iovs, arraysize(iovs), nullptr); if (status_t status = rpcRec(connection, session, "reply body", iovs, countof(iovs), nullptr); status != OK) return status; Loading Loading @@ -760,7 +759,7 @@ status_t RpcState::sendDecStrongToTarget(const sp<RpcSession::RpcConnection>& co .bodySize = sizeof(RpcDecStrong), }; iovec iovs[]{{&cmd, sizeof(cmd)}, {&body, sizeof(body)}}; return rpcSend(connection, session, "dec ref", iovs, arraysize(iovs), std::nullopt); return rpcSend(connection, session, "dec ref", iovs, countof(iovs), std::nullopt); } status_t RpcState::getAndExecuteCommand(const sp<RpcSession::RpcConnection>& connection, Loading Loading @@ -1143,7 +1142,7 @@ processTransactInternalTailCall: {const_cast<uint8_t*>(reply.data()), reply.dataSize()}, objectTableSpan.toIovec(), }; return rpcSend(connection, session, "reply", iovs, arraysize(iovs), std::nullopt, return rpcSend(connection, session, "reply", iovs, countof(iovs), std::nullopt, rpcFields->mFds.get()); } Loading libs/binder/ServiceManagerHost.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,8 @@ public: [[nodiscard]] const std::optional<unsigned int>& hostPort() const { return mPort; } private: DISALLOW_COPY_AND_ASSIGN(AdbForwarder); AdbForwarder(const AdbForwarder&) = delete; void operator=(const AdbForwarder&) = delete; explicit AdbForwarder(unsigned int port) : mPort(port) {} std::optional<unsigned int> mPort; }; Loading Loading
libs/binder/FdTrigger.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -21,10 +21,11 @@ #include <poll.h> #include <android-base/macros.h> #include <android-base/scopeguard.h> #include "RpcState.h" #include "Utils.h" namespace android { std::unique_ptr<FdTrigger> FdTrigger::make() { Loading Loading @@ -77,7 +78,7 @@ status_t FdTrigger::triggerablePoll(const android::RpcTransportFd& transportFd, auto pollingStateGuard = android::base::make_scope_guard([&]() { transportFd.setPollingState(false); }); int ret = TEMP_FAILURE_RETRY(poll(pfd, arraysize(pfd), -1)); int ret = TEMP_FAILURE_RETRY(poll(pfd, countof(pfd), -1)); if (ret < 0) { return -errno; } Loading
libs/binder/IPCThreadState.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <binder/BpBinder.h> #include <binder/TextOutput.h> #include <android-base/macros.h> #include <cutils/sched_policy.h> #include <utils/CallStack.h> #include <utils/Log.h> Loading Loading @@ -395,7 +394,9 @@ void IPCThreadState::restoreGetCallingSpGuard(const SpGuard* guard) { } void IPCThreadState::checkContextIsBinderForUse(const char* use) const { if (LIKELY(mServingStackPointerGuard == nullptr)) return; if (mServingStackPointerGuard == nullptr) [[likely]] { return; } if (!mServingStackPointer || mServingStackPointerGuard->address < mServingStackPointer) { LOG_ALWAYS_FATAL("In context %s, %s does not make sense (binder sp: %p, guard: %p).", Loading Loading @@ -832,7 +833,7 @@ status_t IPCThreadState::transact(int32_t handle, } if ((flags & TF_ONE_WAY) == 0) { if (UNLIKELY(mCallRestriction != ProcessState::CallRestriction::NONE)) { if (mCallRestriction != ProcessState::CallRestriction::NONE) [[unlikely]] { if (mCallRestriction == ProcessState::CallRestriction::ERROR_IF_NOT_ONEWAY) { ALOGE("Process making non-oneway call (code: %u) but is restricted.", code); CallStack::logStack("non-oneway call", CallStack::getCurrent(10).get(), Loading
libs/binder/RpcSession.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <string_view> #include <android-base/macros.h> #include <android-base/scopeguard.h> #include <binder/BpBinder.h> #include <binder/Parcel.h> Loading Loading @@ -411,7 +410,9 @@ public: } private: DISALLOW_COPY_AND_ASSIGN(JavaThreadAttacher); JavaThreadAttacher(const JavaThreadAttacher&) = delete; void operator=(const JavaThreadAttacher&) = delete; bool mAttached = false; static JavaVM* getJavaVM() { Loading
libs/binder/RpcState.cpp +4 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #include "RpcState.h" #include <android-base/macros.h> #include <android-base/scopeguard.h> #include <binder/BpBinder.h> #include <binder/IPCThreadState.h> Loading Loading @@ -601,7 +600,7 @@ status_t RpcState::transactAddress(const sp<RpcSession::RpcConnection>& connecti objectTableSpan.toIovec(), }; if (status_t status = rpcSend( connection, session, "transaction", iovs, arraysize(iovs), connection, session, "transaction", iovs, countof(iovs), [&] { if (waitUs > kWaitLogUs) { ALOGE("Cannot send command, trying to process pending refcounts. Waiting " Loading Loading @@ -690,7 +689,7 @@ status_t RpcState::waitForReply(const sp<RpcSession::RpcConnection>& connection, {&rpcReply, rpcReplyWireSize}, {data.data(), data.size()}, }; if (status_t status = rpcRec(connection, session, "reply body", iovs, arraysize(iovs), nullptr); if (status_t status = rpcRec(connection, session, "reply body", iovs, countof(iovs), nullptr); status != OK) return status; Loading Loading @@ -760,7 +759,7 @@ status_t RpcState::sendDecStrongToTarget(const sp<RpcSession::RpcConnection>& co .bodySize = sizeof(RpcDecStrong), }; iovec iovs[]{{&cmd, sizeof(cmd)}, {&body, sizeof(body)}}; return rpcSend(connection, session, "dec ref", iovs, arraysize(iovs), std::nullopt); return rpcSend(connection, session, "dec ref", iovs, countof(iovs), std::nullopt); } status_t RpcState::getAndExecuteCommand(const sp<RpcSession::RpcConnection>& connection, Loading Loading @@ -1143,7 +1142,7 @@ processTransactInternalTailCall: {const_cast<uint8_t*>(reply.data()), reply.dataSize()}, objectTableSpan.toIovec(), }; return rpcSend(connection, session, "reply", iovs, arraysize(iovs), std::nullopt, return rpcSend(connection, session, "reply", iovs, countof(iovs), std::nullopt, rpcFields->mFds.get()); } Loading
libs/binder/ServiceManagerHost.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,8 @@ public: [[nodiscard]] const std::optional<unsigned int>& hostPort() const { return mPort; } private: DISALLOW_COPY_AND_ASSIGN(AdbForwarder); AdbForwarder(const AdbForwarder&) = delete; void operator=(const AdbForwarder&) = delete; explicit AdbForwarder(unsigned int port) : mPort(port) {} std::optional<unsigned int> mPort; }; Loading