diff options
author | 2022-01-21 17:22:09 -0800 | |
---|---|---|
committer | 2022-01-27 17:08:31 -0800 | |
commit | 9adfeaf07d46772fdae3512cbfee8082689ee967 (patch) | |
tree | 35b8e7eddcb3419476acdd31ed7de7d5dec16f9b /libs/binder/RpcState.cpp | |
parent | 6d5ef677c9eb274147043a431993e7646dab4669 (diff) |
Fix building libbinder against musl
musl libc uses the posix definition of msg_iovlen as int. Change the
niovs argument to an int, make sure it is not negative, and cast it to
size_t if necessary.
Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I6ff9206e9e7396f2f89622735f790b4fac18f76c
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r-- | libs/binder/RpcState.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index 6286c9c7bc..4ddbce71a8 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -310,9 +310,9 @@ RpcState::CommandData::CommandData(size_t size) : mSize(size) { } status_t RpcState::rpcSend(const sp<RpcSession::RpcConnection>& connection, - const sp<RpcSession>& session, const char* what, iovec* iovs, - size_t niovs, const std::function<status_t()>& altPoll) { - for (size_t i = 0; i < niovs; i++) { + const sp<RpcSession>& session, const char* what, iovec* iovs, int niovs, + const std::function<status_t()>& altPoll) { + for (int i = 0; i < niovs; i++) { LOG_RPC_DETAIL("Sending %s on RpcTransport %p: %s", what, connection->rpcTransport.get(), android::base::HexString(iovs[i].iov_base, iovs[i].iov_len).c_str()); } @@ -321,7 +321,7 @@ status_t RpcState::rpcSend(const sp<RpcSession::RpcConnection>& connection, connection->rpcTransport->interruptableWriteFully(session->mShutdownTrigger.get(), iovs, niovs, altPoll); status != OK) { - LOG_RPC_DETAIL("Failed to write %s (%zu iovs) on RpcTransport %p, error: %s", what, niovs, + LOG_RPC_DETAIL("Failed to write %s (%d iovs) on RpcTransport %p, error: %s", what, niovs, connection->rpcTransport.get(), statusToString(status).c_str()); (void)session->shutdownAndWait(false); return status; @@ -331,19 +331,18 @@ status_t RpcState::rpcSend(const sp<RpcSession::RpcConnection>& connection, } status_t RpcState::rpcRec(const sp<RpcSession::RpcConnection>& connection, - const sp<RpcSession>& session, const char* what, iovec* iovs, - size_t niovs) { + const sp<RpcSession>& session, const char* what, iovec* iovs, int niovs) { if (status_t status = connection->rpcTransport->interruptableReadFully(session->mShutdownTrigger.get(), iovs, niovs, {}); status != OK) { - LOG_RPC_DETAIL("Failed to read %s (%zu iovs) on RpcTransport %p, error: %s", what, niovs, + LOG_RPC_DETAIL("Failed to read %s (%d iovs) on RpcTransport %p, error: %s", what, niovs, connection->rpcTransport.get(), statusToString(status).c_str()); (void)session->shutdownAndWait(false); return status; } - for (size_t i = 0; i < niovs; i++) { + for (int i = 0; i < niovs; i++) { LOG_RPC_DETAIL("Received %s on RpcTransport %p: %s", what, connection->rpcTransport.get(), android::base::HexString(iovs[i].iov_base, iovs[i].iov_len).c_str()); } |