12498b56bSopenharmony_ci/* 22498b56bSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 32498b56bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 42498b56bSopenharmony_ci * you may not use this file except in compliance with the License. 52498b56bSopenharmony_ci * You may obtain a copy of the License at 62498b56bSopenharmony_ci * 72498b56bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 82498b56bSopenharmony_ci * 92498b56bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 102498b56bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 112498b56bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 122498b56bSopenharmony_ci * See the License for the specific language governing permissions and 132498b56bSopenharmony_ci * limitations under the License. 142498b56bSopenharmony_ci */ 152498b56bSopenharmony_ci 162498b56bSopenharmony_ci#include "log_ioctl.h" 172498b56bSopenharmony_ci 182498b56bSopenharmony_cinamespace OHOS { 192498b56bSopenharmony_cinamespace HiviewDFX { 202498b56bSopenharmony_ciusing namespace std; 212498b56bSopenharmony_ci 222498b56bSopenharmony_cistatic string GetSocketName(IoctlCmd cmd) 232498b56bSopenharmony_ci{ 242498b56bSopenharmony_ci if (cmd == IoctlCmd::OUTPUT_RQST) { 252498b56bSopenharmony_ci return OUTPUT_SOCKET_NAME; 262498b56bSopenharmony_ci } else { 272498b56bSopenharmony_ci return CONTROL_SOCKET_NAME; 282498b56bSopenharmony_ci } 292498b56bSopenharmony_ci} 302498b56bSopenharmony_ci 312498b56bSopenharmony_ciLogIoctl::LogIoctl(IoctlCmd rqst, IoctlCmd rsp) : socket(GetSocketName(rqst), 0) 322498b56bSopenharmony_ci{ 332498b56bSopenharmony_ci socketInit = socket.Init(); 342498b56bSopenharmony_ci if (socketInit != SeqPacketSocketResult::CREATE_AND_CONNECTED) { 352498b56bSopenharmony_ci PrintErrorno(errno); 362498b56bSopenharmony_ci } 372498b56bSopenharmony_ci rqstCmd = rqst; 382498b56bSopenharmony_ci rspCmd = rsp; 392498b56bSopenharmony_ci} 402498b56bSopenharmony_ci 412498b56bSopenharmony_ciint LogIoctl::SendMsgHeader(IoctlCmd cmd, size_t len) 422498b56bSopenharmony_ci{ 432498b56bSopenharmony_ci MsgHeader header = {MSG_VER, static_cast<uint8_t>(cmd), 0, static_cast<uint16_t>(len)}; 442498b56bSopenharmony_ci if (socketInit != SeqPacketSocketResult::CREATE_AND_CONNECTED) { 452498b56bSopenharmony_ci return ERR_SOCKET_CLIENT_INIT_FAIL; 462498b56bSopenharmony_ci } 472498b56bSopenharmony_ci int ret = socket.WriteAll(reinterpret_cast<char*>(&header), sizeof(MsgHeader)); 482498b56bSopenharmony_ci if (ret < 0) { 492498b56bSopenharmony_ci PrintErrorno(errno); 502498b56bSopenharmony_ci return ERR_SOCKET_WRITE_MSG_HEADER_FAIL; 512498b56bSopenharmony_ci } 522498b56bSopenharmony_ci return RET_SUCCESS; 532498b56bSopenharmony_ci} 542498b56bSopenharmony_ci 552498b56bSopenharmony_ciint LogIoctl::ReceiveMsgHeaer(MsgHeader& hdr) 562498b56bSopenharmony_ci{ 572498b56bSopenharmony_ci int ret = socket.RecvMsg(reinterpret_cast<char *>(&hdr), sizeof(hdr)); 582498b56bSopenharmony_ci if (ret <= 0) { 592498b56bSopenharmony_ci return ERR_SOCKET_RECEIVE_RSP; 602498b56bSopenharmony_ci } 612498b56bSopenharmony_ci return RET_SUCCESS; 622498b56bSopenharmony_ci} 632498b56bSopenharmony_ci 642498b56bSopenharmony_ciint LogIoctl::GetRsp(char* rsp, int len) 652498b56bSopenharmony_ci{ 662498b56bSopenharmony_ci int ret = socket.RecvMsg(rsp, len); 672498b56bSopenharmony_ci if (ret <= 0) { 682498b56bSopenharmony_ci return ERR_SOCKET_RECEIVE_RSP; 692498b56bSopenharmony_ci } 702498b56bSopenharmony_ci return RET_SUCCESS; 712498b56bSopenharmony_ci} 722498b56bSopenharmony_ci 732498b56bSopenharmony_ciint LogIoctl::ReceiveProcTagStats(StatsQueryRsp &rsp) 742498b56bSopenharmony_ci{ 752498b56bSopenharmony_ci int i = 0; 762498b56bSopenharmony_ci for (i = 0; i < rsp.procNum; i++) { 772498b56bSopenharmony_ci ProcStatsRsp &pStats = rsp.pStats[i]; 782498b56bSopenharmony_ci int msgSize = pStats.tagNum * sizeof(TagStatsRsp); 792498b56bSopenharmony_ci if (msgSize == 0) { 802498b56bSopenharmony_ci pStats.tStats = nullptr; 812498b56bSopenharmony_ci continue; 822498b56bSopenharmony_ci } 832498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 842498b56bSopenharmony_ci if (tmp == nullptr) { 852498b56bSopenharmony_ci pStats.tStats = nullptr; 862498b56bSopenharmony_ci return RET_FAIL; 872498b56bSopenharmony_ci } 882498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 892498b56bSopenharmony_ci delete []tmp; 902498b56bSopenharmony_ci tmp = nullptr; 912498b56bSopenharmony_ci return RET_FAIL; 922498b56bSopenharmony_ci } 932498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 942498b56bSopenharmony_ci pStats.tStats = nullptr; 952498b56bSopenharmony_ci delete []tmp; 962498b56bSopenharmony_ci tmp = nullptr; 972498b56bSopenharmony_ci return RET_FAIL; 982498b56bSopenharmony_ci } 992498b56bSopenharmony_ci pStats.tStats = reinterpret_cast<TagStatsRsp*>(tmp); 1002498b56bSopenharmony_ci } 1012498b56bSopenharmony_ci return RET_SUCCESS; 1022498b56bSopenharmony_ci} 1032498b56bSopenharmony_ci 1042498b56bSopenharmony_ciint LogIoctl::ReceiveProcLogTypeStats(StatsQueryRsp &rsp) 1052498b56bSopenharmony_ci{ 1062498b56bSopenharmony_ci int i = 0; 1072498b56bSopenharmony_ci for (i = 0; i < rsp.procNum; i++) { 1082498b56bSopenharmony_ci ProcStatsRsp &pStats = rsp.pStats[i]; 1092498b56bSopenharmony_ci int msgSize = pStats.typeNum * sizeof(LogTypeStatsRsp); 1102498b56bSopenharmony_ci if (msgSize == 0) { 1112498b56bSopenharmony_ci continue; 1122498b56bSopenharmony_ci } 1132498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 1142498b56bSopenharmony_ci if (tmp == nullptr) { 1152498b56bSopenharmony_ci pStats.lStats = nullptr; 1162498b56bSopenharmony_ci return RET_FAIL; 1172498b56bSopenharmony_ci } 1182498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 1192498b56bSopenharmony_ci delete []tmp; 1202498b56bSopenharmony_ci tmp = nullptr; 1212498b56bSopenharmony_ci return RET_FAIL; 1222498b56bSopenharmony_ci } 1232498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 1242498b56bSopenharmony_ci pStats.lStats = nullptr; 1252498b56bSopenharmony_ci delete []tmp; 1262498b56bSopenharmony_ci tmp = nullptr; 1272498b56bSopenharmony_ci return RET_FAIL; 1282498b56bSopenharmony_ci } 1292498b56bSopenharmony_ci pStats.lStats = reinterpret_cast<LogTypeStatsRsp*>(tmp); 1302498b56bSopenharmony_ci } 1312498b56bSopenharmony_ci return RET_SUCCESS; 1322498b56bSopenharmony_ci} 1332498b56bSopenharmony_ci 1342498b56bSopenharmony_ciint LogIoctl::ReceiveProcStats(StatsQueryRsp &rsp) 1352498b56bSopenharmony_ci{ 1362498b56bSopenharmony_ci if (rsp.procNum == 0) { 1372498b56bSopenharmony_ci return RET_FAIL; 1382498b56bSopenharmony_ci } 1392498b56bSopenharmony_ci int msgSize = rsp.procNum * sizeof(ProcStatsRsp); 1402498b56bSopenharmony_ci if (msgSize == 0) { 1412498b56bSopenharmony_ci return RET_SUCCESS; 1422498b56bSopenharmony_ci } 1432498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 1442498b56bSopenharmony_ci if (tmp == nullptr) { 1452498b56bSopenharmony_ci rsp.pStats = nullptr; 1462498b56bSopenharmony_ci return RET_FAIL; 1472498b56bSopenharmony_ci } 1482498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 1492498b56bSopenharmony_ci delete []tmp; 1502498b56bSopenharmony_ci tmp = nullptr; 1512498b56bSopenharmony_ci return RET_FAIL; 1522498b56bSopenharmony_ci } 1532498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 1542498b56bSopenharmony_ci rsp.pStats = nullptr; 1552498b56bSopenharmony_ci delete []tmp; 1562498b56bSopenharmony_ci tmp = nullptr; 1572498b56bSopenharmony_ci return RET_FAIL; 1582498b56bSopenharmony_ci } 1592498b56bSopenharmony_ci rsp.pStats = reinterpret_cast<ProcStatsRsp*>(tmp); 1602498b56bSopenharmony_ci return RET_SUCCESS; 1612498b56bSopenharmony_ci} 1622498b56bSopenharmony_ci 1632498b56bSopenharmony_ciint LogIoctl::ReceiveDomainTagStats(StatsQueryRsp &rsp) 1642498b56bSopenharmony_ci{ 1652498b56bSopenharmony_ci int i = 0; 1662498b56bSopenharmony_ci for (i = 0; i < rsp.typeNum; i++) { 1672498b56bSopenharmony_ci LogTypeDomainStatsRsp &ldStats = rsp.ldStats[i]; 1682498b56bSopenharmony_ci int j = 0; 1692498b56bSopenharmony_ci for (j = 0; j < ldStats.domainNum; j++) { 1702498b56bSopenharmony_ci DomainStatsRsp &dStats = ldStats.dStats[j]; 1712498b56bSopenharmony_ci int msgSize = dStats.tagNum * sizeof(TagStatsRsp); 1722498b56bSopenharmony_ci if (msgSize == 0) { 1732498b56bSopenharmony_ci dStats.tStats = nullptr; 1742498b56bSopenharmony_ci continue; 1752498b56bSopenharmony_ci } 1762498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 1772498b56bSopenharmony_ci if (tmp == nullptr) { 1782498b56bSopenharmony_ci dStats.tStats = nullptr; 1792498b56bSopenharmony_ci return RET_FAIL; 1802498b56bSopenharmony_ci } 1812498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 1822498b56bSopenharmony_ci delete []tmp; 1832498b56bSopenharmony_ci tmp = nullptr; 1842498b56bSopenharmony_ci return RET_FAIL; 1852498b56bSopenharmony_ci } 1862498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 1872498b56bSopenharmony_ci dStats.tStats = nullptr; 1882498b56bSopenharmony_ci delete []tmp; 1892498b56bSopenharmony_ci tmp = nullptr; 1902498b56bSopenharmony_ci return RET_FAIL; 1912498b56bSopenharmony_ci } 1922498b56bSopenharmony_ci dStats.tStats = reinterpret_cast<TagStatsRsp*>(tmp); 1932498b56bSopenharmony_ci } 1942498b56bSopenharmony_ci } 1952498b56bSopenharmony_ci return RET_SUCCESS; 1962498b56bSopenharmony_ci} 1972498b56bSopenharmony_ci 1982498b56bSopenharmony_ciint LogIoctl::ReceiveDomainStats(StatsQueryRsp &rsp) 1992498b56bSopenharmony_ci{ 2002498b56bSopenharmony_ci int i = 0; 2012498b56bSopenharmony_ci for (i = 0; i < rsp.typeNum; i++) { 2022498b56bSopenharmony_ci LogTypeDomainStatsRsp &ldStats = rsp.ldStats[i]; 2032498b56bSopenharmony_ci int msgSize = ldStats.domainNum * sizeof(DomainStatsRsp); 2042498b56bSopenharmony_ci if (msgSize == 0) { 2052498b56bSopenharmony_ci continue; 2062498b56bSopenharmony_ci } 2072498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 2082498b56bSopenharmony_ci if (tmp == nullptr) { 2092498b56bSopenharmony_ci ldStats.dStats = nullptr; 2102498b56bSopenharmony_ci return RET_FAIL; 2112498b56bSopenharmony_ci } 2122498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 2132498b56bSopenharmony_ci delete []tmp; 2142498b56bSopenharmony_ci tmp = nullptr; 2152498b56bSopenharmony_ci return RET_FAIL; 2162498b56bSopenharmony_ci } 2172498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 2182498b56bSopenharmony_ci ldStats.dStats = nullptr; 2192498b56bSopenharmony_ci delete []tmp; 2202498b56bSopenharmony_ci tmp = nullptr; 2212498b56bSopenharmony_ci return RET_FAIL; 2222498b56bSopenharmony_ci } 2232498b56bSopenharmony_ci ldStats.dStats = reinterpret_cast<DomainStatsRsp*>(tmp); 2242498b56bSopenharmony_ci } 2252498b56bSopenharmony_ci return RET_SUCCESS; 2262498b56bSopenharmony_ci} 2272498b56bSopenharmony_ci 2282498b56bSopenharmony_ciint LogIoctl::ReceiveLogTypeDomainStats(StatsQueryRsp &rsp) 2292498b56bSopenharmony_ci{ 2302498b56bSopenharmony_ci if (rsp.typeNum == 0) { 2312498b56bSopenharmony_ci return RET_FAIL; 2322498b56bSopenharmony_ci } 2332498b56bSopenharmony_ci int msgSize = rsp.typeNum * sizeof(LogTypeDomainStatsRsp); 2342498b56bSopenharmony_ci if (msgSize == 0) { 2352498b56bSopenharmony_ci return RET_SUCCESS; 2362498b56bSopenharmony_ci } 2372498b56bSopenharmony_ci char* tmp = new (std::nothrow) char[msgSize]; 2382498b56bSopenharmony_ci if (tmp == nullptr) { 2392498b56bSopenharmony_ci rsp.ldStats = nullptr; 2402498b56bSopenharmony_ci return RET_FAIL; 2412498b56bSopenharmony_ci } 2422498b56bSopenharmony_ci if (memset_s(tmp, msgSize, 0, msgSize) != 0) { 2432498b56bSopenharmony_ci delete []tmp; 2442498b56bSopenharmony_ci tmp = nullptr; 2452498b56bSopenharmony_ci return RET_FAIL; 2462498b56bSopenharmony_ci } 2472498b56bSopenharmony_ci if (GetRsp(tmp, msgSize) != RET_SUCCESS) { 2482498b56bSopenharmony_ci rsp.ldStats = nullptr; 2492498b56bSopenharmony_ci delete []tmp; 2502498b56bSopenharmony_ci tmp = nullptr; 2512498b56bSopenharmony_ci return RET_FAIL; 2522498b56bSopenharmony_ci } 2532498b56bSopenharmony_ci rsp.ldStats = reinterpret_cast<LogTypeDomainStatsRsp*>(tmp); 2542498b56bSopenharmony_ci return RET_SUCCESS; 2552498b56bSopenharmony_ci} 2562498b56bSopenharmony_ci 2572498b56bSopenharmony_civoid LogIoctl::DeleteLogStatsInfo(StatsQueryRsp &rsp) 2582498b56bSopenharmony_ci{ 2592498b56bSopenharmony_ci if (rsp.ldStats == nullptr) { 2602498b56bSopenharmony_ci return; 2612498b56bSopenharmony_ci } 2622498b56bSopenharmony_ci int i = 0; 2632498b56bSopenharmony_ci for (i = 0; i < rsp.typeNum; i++) { 2642498b56bSopenharmony_ci LogTypeDomainStatsRsp &ldStats = rsp.ldStats[i]; 2652498b56bSopenharmony_ci if (ldStats.dStats == nullptr) { 2662498b56bSopenharmony_ci break; 2672498b56bSopenharmony_ci } 2682498b56bSopenharmony_ci int j = 0; 2692498b56bSopenharmony_ci for (j = 0; j < ldStats.domainNum; j++) { 2702498b56bSopenharmony_ci DomainStatsRsp &dStats = ldStats.dStats[j]; 2712498b56bSopenharmony_ci if (dStats.tStats == nullptr) { 2722498b56bSopenharmony_ci break; 2732498b56bSopenharmony_ci } 2742498b56bSopenharmony_ci delete []dStats.tStats; 2752498b56bSopenharmony_ci dStats.tStats = nullptr; 2762498b56bSopenharmony_ci } 2772498b56bSopenharmony_ci delete []ldStats.dStats; 2782498b56bSopenharmony_ci ldStats.dStats = nullptr; 2792498b56bSopenharmony_ci } 2802498b56bSopenharmony_ci delete []rsp.ldStats; 2812498b56bSopenharmony_ci rsp.ldStats = nullptr; 2822498b56bSopenharmony_ci 2832498b56bSopenharmony_ci if (rsp.pStats == nullptr) { 2842498b56bSopenharmony_ci return; 2852498b56bSopenharmony_ci } 2862498b56bSopenharmony_ci for (i = 0; i < rsp.procNum; i++) { 2872498b56bSopenharmony_ci ProcStatsRsp &pStats = rsp.pStats[i]; 2882498b56bSopenharmony_ci if (pStats.lStats == nullptr) { 2892498b56bSopenharmony_ci return; 2902498b56bSopenharmony_ci } 2912498b56bSopenharmony_ci delete []pStats.lStats; 2922498b56bSopenharmony_ci pStats.lStats = nullptr; 2932498b56bSopenharmony_ci if (pStats.tStats == nullptr) { 2942498b56bSopenharmony_ci return; 2952498b56bSopenharmony_ci } 2962498b56bSopenharmony_ci delete []pStats.tStats; 2972498b56bSopenharmony_ci pStats.tStats = nullptr; 2982498b56bSopenharmony_ci } 2992498b56bSopenharmony_ci} 3002498b56bSopenharmony_ci 3012498b56bSopenharmony_ciint LogIoctl::RequestOutput(const OutputRqst& rqst, std::function<int(const OutputRsp& rsp)> handle) 3022498b56bSopenharmony_ci{ 3032498b56bSopenharmony_ci // 0. Send reqeust message and process the response header 3042498b56bSopenharmony_ci int ret = RequestMsgHead<OutputRqst, OutputRsp>(rqst); 3052498b56bSopenharmony_ci if (ret != RET_SUCCESS) { 3062498b56bSopenharmony_ci return ret; 3072498b56bSopenharmony_ci } 3082498b56bSopenharmony_ci // 1. process the response message 3092498b56bSopenharmony_ci return ReceiveAndProcessOutputRsp(handle); 3102498b56bSopenharmony_ci} 3112498b56bSopenharmony_ci 3122498b56bSopenharmony_ciint LogIoctl::ReceiveAndProcessOutputRsp(std::function<int(const OutputRsp& rsp)> handle) 3132498b56bSopenharmony_ci{ 3142498b56bSopenharmony_ci vector<char> buffer(DEFAULT_RECV_BUF_LEN, 0); 3152498b56bSopenharmony_ci OutputRsp *rsp = reinterpret_cast<OutputRsp *>(buffer.data()); 3162498b56bSopenharmony_ci while (true) { 3172498b56bSopenharmony_ci int ret = GetRsp(reinterpret_cast<char*>(rsp), DEFAULT_RECV_BUF_LEN); 3182498b56bSopenharmony_ci if (ret != RET_SUCCESS) { 3192498b56bSopenharmony_ci return ret; 3202498b56bSopenharmony_ci } 3212498b56bSopenharmony_ci ret = handle(*rsp); 3222498b56bSopenharmony_ci if (likely(ret == static_cast<int>(SUCCESS_CONTINUE))) { 3232498b56bSopenharmony_ci continue; 3242498b56bSopenharmony_ci } 3252498b56bSopenharmony_ci return ret; 3262498b56bSopenharmony_ci } 3272498b56bSopenharmony_ci} 3282498b56bSopenharmony_ci 3292498b56bSopenharmony_ciint LogIoctl::RequestStatsQuery(const StatsQueryRqst& rqst, std::function<int(const StatsQueryRsp& rsp)> handle) 3302498b56bSopenharmony_ci{ 3312498b56bSopenharmony_ci // 0. Send reqeust message and process the response header 3322498b56bSopenharmony_ci int ret = RequestMsgHead<StatsQueryRqst, StatsQueryRsp>(rqst); 3332498b56bSopenharmony_ci if (ret != RET_SUCCESS) { 3342498b56bSopenharmony_ci return ret; 3352498b56bSopenharmony_ci } 3362498b56bSopenharmony_ci // 1. process the response message 3372498b56bSopenharmony_ci return ReceiveAndProcessStatsQueryRsp(handle); 3382498b56bSopenharmony_ci} 3392498b56bSopenharmony_ci 3402498b56bSopenharmony_ciint LogIoctl::ReceiveAndProcessStatsQueryRsp(std::function<int(const StatsQueryRsp& rsp)> handle) 3412498b56bSopenharmony_ci{ 3422498b56bSopenharmony_ci int ret; 3432498b56bSopenharmony_ci StatsQueryRsp rsp = { 0 }; 3442498b56bSopenharmony_ci do { 3452498b56bSopenharmony_ci ret = GetRsp(reinterpret_cast<char*>(&rsp), sizeof(rsp)); 3462498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3472498b56bSopenharmony_ci break; 3482498b56bSopenharmony_ci } 3492498b56bSopenharmony_ci rsp.ldStats = nullptr; 3502498b56bSopenharmony_ci rsp.pStats = nullptr; 3512498b56bSopenharmony_ci ret = ReceiveLogTypeDomainStats(rsp); 3522498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3532498b56bSopenharmony_ci break; 3542498b56bSopenharmony_ci } 3552498b56bSopenharmony_ci ret = ReceiveDomainStats(rsp); 3562498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3572498b56bSopenharmony_ci break; 3582498b56bSopenharmony_ci } 3592498b56bSopenharmony_ci ret = ReceiveDomainTagStats(rsp); 3602498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3612498b56bSopenharmony_ci break; 3622498b56bSopenharmony_ci } 3632498b56bSopenharmony_ci ret = ReceiveProcStats(rsp); 3642498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3652498b56bSopenharmony_ci break; 3662498b56bSopenharmony_ci } 3672498b56bSopenharmony_ci ret = ReceiveProcLogTypeStats(rsp); 3682498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3692498b56bSopenharmony_ci break; 3702498b56bSopenharmony_ci } 3712498b56bSopenharmony_ci ret = ReceiveProcTagStats(rsp); 3722498b56bSopenharmony_ci if (RET_SUCCESS != ret) { 3732498b56bSopenharmony_ci break; 3742498b56bSopenharmony_ci } 3752498b56bSopenharmony_ci } while (0); 3762498b56bSopenharmony_ci if (ret == RET_SUCCESS) { 3772498b56bSopenharmony_ci ret = handle(rsp); 3782498b56bSopenharmony_ci } 3792498b56bSopenharmony_ci DeleteLogStatsInfo(rsp); 3802498b56bSopenharmony_ci return ret; 3812498b56bSopenharmony_ci} 3822498b56bSopenharmony_ci} // namespace HiviewDFX 3832498b56bSopenharmony_ci} // namespace OHOS