!918 ipc日志整改

Merge pull request !918 from dengyutao/master
This commit is contained in:
openharmony_ci 2024-01-09 10:46:46 +00:00 committed by Gitee
commit c97bf5b99f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 11 additions and 5 deletions

View File

@ -56,6 +56,8 @@ using namespace IPC_SINGLE;
handle, error, (desc).c_str())
static constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, LOG_ID_IPC_PROXY, "IPCObjectProxy" };
static constexpr uint32_t IPC_OBJECT_MASK = 0xffffff;
IPCObjectProxy::IPCObjectProxy(int handle, std::u16string descriptor, int proto)
: IRemoteObject(std::move(descriptor)), handle_(handle), proto_(proto), isFinishInit_(false), isRemoteDead_(false)
{
@ -65,7 +67,9 @@ IPCObjectProxy::IPCObjectProxy(int handle, std::u16string descriptor, int proto)
invoker->LinkRemoteInvoker(&invokerData_);
}
#endif
ZLOGD(LABEL, "create, handle:%{public}u desc:%{public}s", handle_, Str16ToStr8(descriptor_).c_str());
ZLOGD(LABEL, "handle:%{public}u desc:%{public}s %{public}u", handle_,
IPCProcessSkeleton::ConvertToSecureDesc(Str16ToStr8(descriptor_)).c_str(),
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this)) & IPC_OBJECT_MASK);
ExtendObjectLifetime();
}
@ -77,7 +81,9 @@ IPCObjectProxy::~IPCObjectProxy()
invoker->UnlinkRemoteInvoker(&invokerData_);
}
#endif
ZLOGI(LABEL, "destroy, handle:%{public}u desc:%{public}s", handle_, Str16ToStr8(remoteDescriptor_).c_str());
ZLOGI(LABEL, "handle:%{public}u desc:%{public}s %{public}u", handle_,
IPCProcessSkeleton::ConvertToSecureDesc(Str16ToStr8(descriptor_)).c_str(),
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this)) & IPC_OBJECT_MASK);
}
int32_t IPCObjectProxy::GetObjectRefCount()

View File

@ -16,6 +16,7 @@
#include "ipc_thread_skeleton.h"
#include <memory>
#include <sys/syscall.h>
#include "binder_invoker.h"
#include "hilog/log_c.h"
@ -45,7 +46,6 @@ void IPCThreadSkeleton::TlsDestructor(void *args)
auto *current = static_cast<IPCThreadSkeleton *>(args);
auto it = current->invokers_.find(IRemoteObject::IF_PROT_BINDER);
if (it != current->invokers_.end()) {
ZLOGW(LABEL, "thread exit, flush commands");
BinderInvoker *invoker = reinterpret_cast<BinderInvoker *>(it->second);
invoker->FlushCommands(nullptr);
invoker->ExitCurrentThread();
@ -82,7 +82,8 @@ IPCThreadSkeleton::IPCThreadSkeleton()
IPCThreadSkeleton::~IPCThreadSkeleton()
{
std::lock_guard<std::recursive_mutex> lockGuard(mutex_);
ZLOGE(LABEL, "IPCThreadSkeleton delete");
ZLOGI(LABEL, "%{public}u_%{public}u", static_cast<uint32_t>(getpid()),
static_cast<uint32_t>(syscall(SYS_gettid)));
for (auto it = invokers_.begin(); it != invokers_.end();) {
delete it->second;
it = invokers_.erase(it);

View File

@ -717,7 +717,6 @@ void BinderInvoker::JoinProcessThread(bool initiative) {}
int BinderInvoker::TransactWithDriver(bool doRead)
{
if ((binderConnector_ == nullptr) || (!binderConnector_->IsDriverAlive())) {
ZLOGE(LABEL, "Binder Driver died");
return IPC_INVOKER_CONNECT_ERR;
}