Lines Matching refs:pid

77 bool ReadFileInfo(char *buffer, const int32_t &pid, const char *fileName)  in ReadFileInfo()  argument
81 if (sprintf_s(filePath, sizeof(filePath), "/proc/%d/%s", pid, fileName) <= 0) { in ReadFileInfo()
110 bool CheckUid(const int32_t &pid, const int newUid) in CheckUid() argument
112 if (ReadFileInfo(g_buffer, pid, "status")) { in CheckUid()
113 GTEST_LOG_(INFO) << "CheckUid pid " << pid << " buffer :" << g_buffer; in CheckUid()
125 …HILOG_INFO(LOG_CORE, "new proc(%{public}d) uid = %{public}d, setUid=%{public}d.", pid, uid, newUid… in CheckUid()
133 bool CheckGid(const int32_t &pid, const int newGid) in CheckGid() argument
135 if (ReadFileInfo(g_buffer, pid, "status")) { in CheckGid()
136 GTEST_LOG_(INFO) << "CheckGid pid " << pid << " buffer :" << g_buffer; in CheckGid()
152 …HILOG_INFO(LOG_CORE, "new proc(%{public}d) gid = %{public}d, setGid=%{public}d.", pid, gid, newGid… in CheckGid()
160 std::size_t GetGids(const int32_t &pid, std::vector<int32_t> &gids) in GetGids() argument
162 if (ReadFileInfo(g_buffer, pid, "status")) { in GetGids()
163 GTEST_LOG_(INFO) << "GetGids pid " << pid << " buffer :" << g_buffer; in GetGids()
194 bool CheckGids(const int32_t &pid, const std::vector<int32_t> newGids) in CheckGids() argument
198 std::size_t gCount = GetGids(pid, gids); in CheckGids()
205 bool CheckGidsCount(const int32_t &pid, const std::vector<int32_t> newGids) in CheckGidsCount() argument
209 std::size_t gCount = GetGids(pid, gids); in CheckGidsCount()
216 bool CheckProcName(const int32_t &pid, const std::string &newProcessName) in CheckProcName() argument
218 if (ReadFileInfo(g_buffer, pid, "cmdline")) { in CheckProcName()
223 GTEST_LOG_(INFO) << "CheckProcName pid " << pid << " buffer :" << g_buffer; in CheckProcName()
234 bool CheckProcessIsDestroyed(const int32_t &pid) in CheckProcessIsDestroyed() argument
237 if (sprintf_s(filePath, sizeof(filePath), "/proc/%d", pid) <= 0) { in CheckProcessIsDestroyed()
676 if (result.pid > 0) {
677 EXPECT_EQ(0, kill(result.pid, SIGKILL));
678 result.pid = DEFAULT_PID;
704 if (result.pid > 0) {
705 EXPECT_EQ(0, kill(result.pid, SIGKILL));
706 result.pid = DEFAULT_PID;
732 EXPECT_NE(0, result.pid);
733 if (result.pid > 0) {
734 EXPECT_EQ(0, kill(result.pid, SIGKILL));
735 result.pid = DEFAULT_PID;
751 EXPECT_NE(0, result.pid);
752 if (result.pid > 0) {
753 EXPECT_EQ(0, kill(result.pid, SIGKILL));
754 result.pid = DEFAULT_PID;
770 EXPECT_NE(0, result.pid);
771 if (result.pid > 0) {
772 EXPECT_EQ(0, kill(result.pid, SIGKILL));
773 result.pid = DEFAULT_PID;
799 EXPECT_NE(0, result.pid);
800 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
801 EXPECT_EQ(true, CheckUid(result.pid, 20010041)); // 20010041 test
802 if (result.pid > 0) {
803 EXPECT_EQ(0, kill(result.pid, SIGKILL));
804 result.pid = DEFAULT_PID;
820 EXPECT_NE(0, result.pid);
821 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
822 EXPECT_EQ(true, CheckUid(result.pid, 20010043)); // 20010043 test
824 if (result.pid > 0) {
825 EXPECT_EQ(0, kill(result.pid, SIGKILL));
826 result.pid = DEFAULT_PID;
842 EXPECT_NE(0, result.pid);
843 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
844 EXPECT_EQ(true, CheckUid(result.pid, 20010043)); // 20010043 test
846 if (result.pid > 0) {
847 EXPECT_EQ(0, kill(result.pid, SIGKILL));
848 result.pid = DEFAULT_PID;
864 EXPECT_NE(0, result.pid);
865 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
866 EXPECT_EQ(true, CheckUid(result.pid, 1000001)); // 1000001 test
868 if (result.pid > 0) {
869 EXPECT_EQ(0, kill(result.pid, SIGKILL));
870 result.pid = DEFAULT_PID;
886 EXPECT_NE(0, result.pid);
887 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
888 EXPECT_EQ(true, CheckUid(result.pid, 1000001)); // 1000001 test
890 if (result.pid > 0) {
891 EXPECT_EQ(0, kill(result.pid, SIGKILL));
892 result.pid = DEFAULT_PID;
918 EXPECT_NE(0, result.pid);
919 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
920 EXPECT_EQ(true, CheckGid(result.pid, 20010043)); // 20010043 test gid
922 if (result.pid > 0) {
923 EXPECT_EQ(0, kill(result.pid, SIGKILL));
924 result.pid = DEFAULT_PID;
941 EXPECT_NE(0, result.pid);
942 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
943 EXPECT_EQ(true, CheckGid(result.pid, 20010041)); // 20010041 test gid
945 if (result.pid > 0) {
946 EXPECT_EQ(0, kill(result.pid, SIGKILL));
947 result.pid = DEFAULT_PID;
964 EXPECT_NE(0, result.pid);
965 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
966 EXPECT_EQ(true, CheckGid(result.pid, 20010041)); // 20010041 test gid
968 if (result.pid > 0) {
969 EXPECT_EQ(0, kill(result.pid, SIGKILL));
970 result.pid = DEFAULT_PID;
986 EXPECT_NE(0, result.pid);
987 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
988 EXPECT_EQ(true, CheckGid(result.pid, 1000001)); // 1000001 test gid
990 if (result.pid > 0) {
991 EXPECT_EQ(0, kill(result.pid, SIGKILL));
992 result.pid = DEFAULT_PID;
1008 EXPECT_NE(0, result.pid);
1009 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1010 EXPECT_EQ(true, CheckGid(result.pid, 1000001)); // 1000001 test gid
1012 if (result.pid > 0) {
1013 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1014 result.pid = DEFAULT_PID;
1040 EXPECT_NE(0, result.pid);
1041 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1044 EXPECT_EQ(true, CheckGids(result.pid, gids));
1046 if (result.pid > 0) {
1047 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1048 result.pid = DEFAULT_PID;
1064 EXPECT_NE(0, result.pid);
1065 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1068 EXPECT_EQ(true, CheckGids(result.pid, gids));
1070 if (result.pid > 0) {
1071 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1072 result.pid = DEFAULT_PID;
1088 EXPECT_NE(0, result.pid);
1089 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1092 EXPECT_EQ(true, CheckGids(result.pid, gids));
1094 if (result.pid > 0) {
1095 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1096 result.pid = DEFAULT_PID;
1111 EXPECT_NE(0, result.pid);
1112 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1115 EXPECT_EQ(true, CheckGids(result.pid, gids));
1117 if (result.pid > 0) {
1118 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1119 result.pid = DEFAULT_PID;
1134 EXPECT_NE(0, result.pid);
1135 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1138 EXPECT_EQ(true, CheckGids(result.pid, gids));
1140 if (result.pid > 0) {
1141 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1142 result.pid = DEFAULT_PID;
1168 EXPECT_NE(0, result.pid);
1169 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1171 EXPECT_EQ(true, CheckProcName(result.pid, "com.example.myapplication"));
1173 if (result.pid > 0) {
1174 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1175 result.pid = DEFAULT_PID;
1200 EXPECT_NE(0, result.pid);
1201 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1215 EXPECT_NE(0, result.pid);
1216 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1219 if (result.pid > 0) {
1220 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1221 result.pid = DEFAULT_PID;
1236 EXPECT_NE(0, result.pid);
1237 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1239 EXPECT_EQ(true, CheckProcName(result.pid, "com.example.myapplication"));
1241 if (result.pid > 0) {
1242 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1243 result.pid = DEFAULT_PID;
1258 EXPECT_NE(0, result.pid);
1259 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1261 EXPECT_EQ(true, CheckProcName(result.pid, "com.example.myapplication"));
1263 if (result.pid > 0) {
1264 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1265 result.pid = DEFAULT_PID;
1288 EXPECT_NE(0, result.pid);
1289 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1290 if (result.pid > 0) {
1291 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1294 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1308 EXPECT_NE(0, result.pid);
1309 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1310 if (result.pid > 0) {
1311 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1314 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1328 EXPECT_NE(0, result.pid);
1329 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1330 if (result.pid > 0) {
1331 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1334 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1348 EXPECT_NE(0, result.pid);
1349 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1350 if (result.pid > 0) {
1351 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1355 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1369 EXPECT_NE(0, result.pid);
1370 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1371 if (result.pid > 0) {
1372 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1376 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1397 EXPECT_NE(0, result.pid);
1398 GTEST_LOG_(INFO) << "newPid :" << result.pid << ".";
1399 if (result.pid > 0) {
1400 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1403 EXPECT_EQ(true, CheckProcessIsDestroyed(result.pid));
1422 if (result.pid > 0) {
1423 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1500 if (result.pid > 0) {
1501 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1576 if (result.pid > 0) {
1577 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1661 if (result.pid > 0) {
1662 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1663 result.pid = DEFAULT_PID;
1690 if (result.pid > 0) {
1691 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1692 result.pid = DEFAULT_PID;
1718 if (result.pid > 0) {
1719 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1720 result.pid = DEFAULT_PID;
1746 if (result.pid > 0) {
1747 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1748 result.pid = DEFAULT_PID;
1788 if (result.pid > 0) {
1789 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1790 result.pid = DEFAULT_PID;
1815 if (result.pid > 0) {
1816 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1817 result.pid = DEFAULT_PID;
1846 if (result.pid > 0) {
1847 EXPECT_EQ(0, kill(result.pid, SIGKILL));
1848 result.pid = DEFAULT_PID;