/system/core/libunwindstack/tests/ |
D | MemoryRemoteTest.cpp | 42 static bool Attach(pid_t pid) { in Attach() argument 43 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in Attach() 47 return TestQuiescePid(pid); in Attach() 50 static bool Detach(pid_t pid) { in Detach() argument 51 return ptrace(PTRACE_DETACH, pid, 0, 0) == 0; in Detach() 61 pid_t pid; in TEST_F() local 62 if ((pid = fork()) == 0) { in TEST_F() 66 ASSERT_LT(0, pid); in TEST_F() 67 TestScopedPidReaper reap(pid); in TEST_F() 69 ASSERT_TRUE(Attach(pid)); in TEST_F() [all …]
|
D | UnwindTest.cpp | 129 static void VerifyUnwind(pid_t pid, Maps* maps, Regs* regs, in VerifyUnwind() argument 131 auto process_memory(Memory::CreateProcessMemory(pid)); in VerifyUnwind() 216 void WaitForRemote(pid_t pid, uint64_t addr, bool leave_attached, bool* completed) { in WaitForRemote() argument 222 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in WaitForRemote() 223 ASSERT_TRUE(TestQuiescePid(pid)) in WaitForRemote() 226 MemoryRemote memory(pid); in WaitForRemote() 233 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0)); in WaitForRemote() 246 pid_t pid; in TEST_F() local 247 if ((pid = fork()) == 0) { in TEST_F() 251 ASSERT_NE(-1, pid); in TEST_F() [all …]
|
/system/extras/ioshark/ |
D | compile-only.sh | 39 awk -v pid=$i '{ if (pid == $7) print $0}' foo > fstrace.$i 61 pid=${stracefile##*.} 62 process_strace $stracefile foo.$pid 63 if ! [ -s foo.$pid ]; then 64 rm foo.$pid 72 if [ -f fstrace.$pid ]; then 73 fgrep mmap foo.$pid > bar 83 grep -w $j fstrace.$pid > foobar 85 sort foo.$pid foobar >> footemp 91 mv footemp parsed_input_trace.$pid [all …]
|
D | collect-straces-ftraces.sh | 41 awk -v pid=$i '{ if (pid == $7) print $0}' foo > fstrace.$i 63 pid=${stracefile##*.} 64 process_strace $stracefile foo.$pid 65 if ! [ -s foo.$pid ]; then 66 rm foo.$pid 74 if [ -f fstrace.$pid ]; then 75 fgrep mmap foo.$pid > bar 85 grep -w $j fstrace.$pid > foobar 87 sort foo.$pid foobar >> footemp 93 mv footemp parsed_input_trace.$pid [all …]
|
/system/core/libbacktrace/ |
D | backtrace_read_benchmarks.cpp | 39 static void Attach(pid_t pid) { in Attach() argument 40 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in Attach() 48 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Attach() 59 ScopedPidReaper(pid_t pid) : pid_(pid) {} in ScopedPidReaper() argument 69 static size_t ProcessVmRead(pid_t pid, uint64_t remote_src, void* dst, size_t len) { in ProcessVmRead() argument 78 ssize_t rc = process_vm_readv(pid, &dst_iov, 1, &src_iov, 1, 0); in ProcessVmRead() 82 static bool PtraceReadLong(pid_t pid, uint64_t addr, long* value) { in PtraceReadLong() argument 86 *value = ptrace(PTRACE_PEEKTEXT, pid, reinterpret_cast<void*>(addr), nullptr); in PtraceReadLong() 93 static size_t PtraceRead(pid_t pid, uint64_t addr, void* dst, size_t bytes) { in PtraceRead() argument 97 if (!PtraceReadLong(pid, addr, &data)) { in PtraceRead() [all …]
|
D | backtrace_test.cpp | 135 static void WaitForStop(pid_t pid) { in WaitForStop() argument 139 while (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) < 0 && (errno == EINTR || errno == ESRCH)) { in WaitForStop() 148 static void CreateRemoteProcess(pid_t* pid) { in CreateRemoteProcess() argument 149 if ((*pid = fork()) == 0) { in CreateRemoteProcess() 154 ASSERT_NE(-1, *pid); in CreateRemoteProcess() 156 ASSERT_TRUE(ptrace(PTRACE_ATTACH, *pid, 0, 0) == 0); in CreateRemoteProcess() 159 WaitForStop(*pid); in CreateRemoteProcess() 162 static void FinishRemoteProcess(pid_t pid) { in FinishRemoteProcess() argument 163 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in FinishRemoteProcess() 165 kill(pid, SIGKILL); in FinishRemoteProcess() [all …]
|
D | backtrace_benchmarks.cpp | 40 static bool CountMaps(pid_t pid, size_t* num_maps) { in CountMaps() argument 45 open((std::string("/proc/") + std::to_string(pid) + "/maps").c_str(), O_RDONLY | O_CLOEXEC); in CountMaps() 47 fprintf(stderr, "Cannot open map file for pid %d: %s\n", pid, strerror(errno)); in CountMaps() 72 pid_t pid; in CreateMap() local 73 if ((pid = fork()) == 0) { in CreateMap() 116 } else if (pid < 0) { in CreateMap() 123 if (CountMaps(pid, &num_maps) && num_maps >= kNumMaps) { in CreateMap() 134 BacktraceMap* map = map_func(pid, false); in CreateMap() 142 kill(pid, SIGKILL); in CreateMap() 143 waitpid(pid, nullptr, 0); in CreateMap()
|
/system/core/libunwindstack/tools/ |
D | unwind.cpp | 37 static bool Attach(pid_t pid) { in Attach() argument 38 if (ptrace(PTRACE_SEIZE, pid, 0, 0) == -1) { in Attach() 42 if (ptrace(PTRACE_INTERRUPT, pid, 0, 0) == -1) { in Attach() 43 ptrace(PTRACE_DETACH, pid, 0, 0); in Attach() 50 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in Attach() 55 printf("%d: Failed to stop.\n", pid); in Attach() 59 void DoUnwind(pid_t pid) { in DoUnwind() argument 60 unwindstack::Regs* regs = unwindstack::Regs::RemoteGet(pid); in DoUnwind() 92 unwindstack::UnwinderFromPid unwinder(1024, pid); in DoUnwind() 113 pid_t pid = atoi(argv[1]); in main() local [all …]
|
/system/core/init/ |
D | lmkd_service.cpp | 37 static LmkdRegistrationResult RegisterProcess(uid_t uid, pid_t pid, int oom_score_adjust) { in RegisterProcess() argument 48 params.pid = pid; in RegisterProcess() 62 static bool UnregisterProcess(pid_t pid) { in UnregisterProcess() argument 70 params.pid = pid; in UnregisterProcess() 86 if (svc->pid() == exclude_pid || svc->pid() == 0) { in RegisterServices() 89 if (RegisterProcess(svc->uid(), svc->pid(), svc->oom_score_adjust()) != in RegisterServices() 98 void LmkdRegister(const std::string& name, uid_t uid, pid_t pid, int oom_score_adjust) { in LmkdRegister() argument 102 result = RegisterProcess(uid, pid, oom_score_adjust); in LmkdRegister() 105 result = RegisterProcess(uid, pid, oom_score_adjust); in LmkdRegister() 112 RegisterServices(pid); in LmkdRegister() [all …]
|
D | sigchld_handler.cpp | 54 auto pid = siginfo.si_pid; in ReapOneProcess() local 55 if (pid == 0) return 0; in ReapOneProcess() 61 auto reaper = make_scope_guard([pid] { TEMP_FAILURE_RETRY(waitpid(pid, nullptr, WNOHANG)); }); in ReapOneProcess() 67 if (SubcontextChildReap(pid)) { in ReapOneProcess() 70 service = ServiceList::GetInstance().FindService(pid, &Service::pid); in ReapOneProcess() 73 name = StringPrintf("Service '%s' (pid %d)", service->name().c_str(), pid); in ReapOneProcess() 88 name = StringPrintf("Untracked pid %d", pid); in ReapOneProcess() 98 if (!service) return pid; in ReapOneProcess() 106 return pid; in ReapOneProcess() 118 pid_t pid; in WaitToBeReaped() local [all …]
|
/system/memory/libmeminfo/libdmabufinfo/tools/ |
D | dmabuf_dump.cpp | 49 static std::string GetProcessComm(const pid_t pid) { in GetProcessComm() argument 50 std::string pid_path = android::base::StringPrintf("/proc/%d/comm", pid); in GetProcessComm() 73 for (auto pid : pid_set) { in PrintDmaBufTable() local 74 printf("%16s:%-5d |", GetProcessComm(pid).c_str(), pid); in PrintDmaBufTable() 89 for (pid_t pid : pid_set) { in PrintDmaBufTable() local 91 if (buf.fdrefs().count(pid) == 1) { in PrintDmaBufTable() 94 pid_refs += buf.fdrefs().at(pid); in PrintDmaBufTable() 95 if (buf.maprefs().count(pid) == 1) { in PrintDmaBufTable() 96 pid_refs += buf.maprefs().at(pid); in PrintDmaBufTable() 107 per_pid_size[pid] += buf.size() / 1024; in PrintDmaBufTable() [all …]
|
/system/memory/libmeminfo/libdmabufinfo/ |
D | dmabufinfo_test.cpp | 65 pid_t pid() const { return child_pid; } in pid() function in fd_sharer 260 void readAndCheckDmaBuffer(std::vector<DmaBuffer>* dmabufs, pid_t pid, const std::string name, in readAndCheckDmaBuffer() argument 264 EXPECT_TRUE(ReadDmaBufInfo(pid, dmabufs)); in readAndCheckDmaBuffer() 269 EXPECT_PID_IN_FDREFS(dmabufs->begin(), pid, expectFdrefs); in readAndCheckDmaBuffer() 270 EXPECT_PID_IN_MAPREFS(dmabufs->begin(), pid, expectMapRefs); in readAndCheckDmaBuffer() 273 bool checkPidRef(DmaBuffer& dmabuf, pid_t pid, int expectFdrefs) { in checkPidRef() argument 274 int fdrefs = dmabuf.fdrefs().find(pid)->second; in checkPidRef() 322 pid_t pid = getpid(); in TEST_F() local 328 ASSERT_TRUE(ReadDmaBufInfo(pid, &dmabufs)); in TEST_F() 334 EXPECT_PID_IN_FDREFS(dmabufs.begin(), pid, true); in TEST_F() [all …]
|
D | dmabufinfo.cpp | 46 static bool ReadDmaBufFdInfo(pid_t pid, int fd, std::string* name, std::string* exporter, in ReadDmaBufFdInfo() argument 48 std::string fdinfo = ::android::base::StringPrintf("/proc/%d/fdinfo/%d", pid, fd); in ReadDmaBufFdInfo() 99 static bool ReadDmaBufFdRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) { in ReadDmaBufFdRefs() argument 100 std::string fdpath = ::android::base::StringPrintf("/proc/%d/fd", pid); in ReadDmaBufFdRefs() 138 if (!ReadDmaBufFdInfo(pid, fd, &name, &exporter, &count)) { in ReadDmaBufFdRefs() 156 buf->AddFdRef(pid); in ReadDmaBufFdRefs() 161 db.AddFdRef(pid); in ReadDmaBufFdRefs() 167 static bool ReadDmaBufMapRefs(pid_t pid, std::vector<DmaBuffer>* dmabufs) { in ReadDmaBufMapRefs() argument 168 std::string mapspath = ::android::base::StringPrintf("/proc/%d/maps", pid); in ReadDmaBufMapRefs() 171 LOG(ERROR) << "Failed to open maps for pid: " << pid; in ReadDmaBufMapRefs() [all …]
|
/system/memory/lmkd/ |
D | statslog.cpp | 38 int pid; member 61 static struct proc* pid_lookup(int pid) { in pid_lookup() argument 66 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid; procp = procp->pidhash_next) in pid_lookup() 120 int stats_write_lmk_kill_occurred_pid(int pid, struct kill_stat *kill_st, in stats_write_lmk_kill_occurred_pid() argument 122 struct proc* proc = pid_lookup(pid); in stats_write_lmk_kill_occurred_pid() 151 static int memory_stat_from_cgroup(struct memory_stat* mem_st, int pid, uid_t uid) { in memory_stat_from_cgroup() argument 155 snprintf(buf, sizeof(buf), MEMCG_PROCESS_MEMORY_STAT_PATH, uid, pid); in memory_stat_from_cgroup() 171 static int memory_stat_from_procfs(struct memory_stat* mem_st, int pid) { in memory_stat_from_procfs() argument 176 snprintf(path, sizeof(path), PROC_STAT_FILE_PATH, pid); in memory_stat_from_procfs() 208 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid) { in stats_read_memory_stat() argument [all …]
|
D | statslog.h | 89 int stats_write_lmk_kill_occurred_pid(int pid, struct kill_stat *kill_st, 92 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid); 97 void stats_store_taskname(int pid, const char* taskname); 107 void stats_remove_taskname(int pid); 120 int stats_write_lmk_kill_occurred_pid(int pid __unused, struct kill_stat *kill_st __unused, in stats_write_lmk_kill_occurred_pid() 126 int pid __unused, uid_t uid __unused) { return NULL; } in stats_read_memory_stat() 128 static inline void stats_store_taskname(int pid __unused, const char* taskname __unused) {} in stats_store_taskname() 132 static inline void stats_remove_taskname(int pid __unused) {} in stats_remove_taskname()
|
/system/memory/libmemtrack/ |
D | memtrack_test.cpp | 32 static void getprocname(pid_t pid, std::string* name) { in getprocname() argument 33 std::string fname = ::android::base::StringPrintf("/proc/%d/cmdline", pid); in getprocname() 56 pid_t pid; in main() local 57 if (!::android::base::ParseInt(de.path().filename().string(), &pid)) { in main() 60 pids.emplace_back(pid); in main() 63 for (auto& pid : pids) { in main() local 72 getprocname(pid, &cmdline); in main() 74 ret = memtrack_proc_get(p, pid); in main() 76 fprintf(stderr, "failed to get memory info for pid %d: %s (%d)\n", pid, strerror(-ret), in main() 89 fprintf(stdout, "%5d %6zu %6zu %6zu %6zu %6zu %6zu %s\n", pid, v1, v2, v3, v4, v5, v6, in main()
|
/system/core/debuggerd/ |
D | debuggerd.cpp | 77 pid_t pid; in main() local 78 if (!android::base::ParseInt(argv[argc - 1], &pid, 1, std::numeric_limits<pid_t>::max())) { in main() 88 if (!android::procinfo::GetProcessInfo(pid, &proc_info)) { in main() 89 err(1, "failed to fetch info for process %d", pid); in main() 93 errx(1, "process %d is a zombie", pid); in main() 96 if (kill(pid, 0) != 0) { in main() 97 err(1, "cannot send signal to process %d", pid); in main() 106 if (!debuggerd_trigger_dump(pid, dump_type, 0, std::move(pipewrite))) { in main() 108 errx(1, "failed to dump process %d", pid); in main()
|
/system/vold/ |
D | Process.cpp | 98 pid_t pid; in KillProcessesWithMounts() local 100 if (!android::base::ParseInt(proc_de->d_name, &pid)) continue; in KillProcessesWithMounts() 103 std::string mounts_file(StringPrintf("/proc/%d/mounts", pid)); in KillProcessesWithMounts() 115 pids.insert(pid); in KillProcessesWithMounts() 121 for (const auto& pid : pids) { in KillProcessesWithMounts() local 122 LOG(WARNING) << "Killing pid "<< pid << " with signal " << strsignal(signal) << in KillProcessesWithMounts() 124 kill(pid, signal); in KillProcessesWithMounts() 142 pid_t pid; in KillProcessesWithOpenFiles() local 144 if (!android::base::ParseInt(proc_de->d_name, &pid)) continue; in KillProcessesWithOpenFiles() 148 auto path = StringPrintf("/proc/%d", pid); in KillProcessesWithOpenFiles() [all …]
|
/system/memory/libmeminfo/libdmabufinfo/include/dmabufinfo/ |
D | dmabufinfo.h | 41 void AddFdRef(pid_t pid) { in AddFdRef() 42 AddRefToPidMap(pid, &fdrefs_); in AddFdRef() 47 void AddMapRef(pid_t pid) { in AddMapRef() 48 AddRefToPidMap(pid, &maprefs_); in AddMapRef() 65 uint64_t Pss(pid_t pid) const { return maprefs_.count(pid) > 0 ? size_ / maprefs_.size() : 0; } in Pss() 82 void AddRefToPidMap(pid_t pid, std::unordered_map<pid_t, int>* map) { in AddRefToPidMap() 85 auto [it, inserted] = map->insert(std::make_pair(pid, 1)); in AddRefToPidMap() 88 pids_.insert(pid); in AddRefToPidMap() 103 bool ReadDmaBufInfo(pid_t pid, std::vector<DmaBuffer>* dmabufs, bool read_fdrefs = true); 110 bool AppendDmaBufInfo(pid_t pid, std::vector<DmaBuffer>* dmabufs, bool read_fdrefs = true);
|
/system/core/debuggerd/client/ |
D | debuggerd_client.cpp | 53 static bool send_signal(pid_t pid, const DebuggerdDumpType dump_type) { in send_signal() argument 58 if (sigqueue(pid, signal, val) != 0) { in send_signal() 59 PLOG(ERROR) << "libdebuggerd_client: failed to send signal to pid " << pid; in send_signal() 73 static void get_wchan_header(pid_t pid, std::stringstream& buffer) { in get_wchan_header() argument 81 std::string path = "/proc/" + std::to_string(pid) + "/cmdline"; in get_wchan_header() 95 buffer << "\n----- Waiting Channels: pid " << pid << " at " << time_now << " -----\n" in get_wchan_header() 99 static void get_wchan_footer(pid_t pid, std::stringstream& buffer) { in get_wchan_footer() argument 100 buffer << "----- end " << std::to_string(pid) << " -----\n"; in get_wchan_footer() 107 static std::string get_wchan_data(pid_t pid) { in get_wchan_data() argument 111 if (!android::procinfo::GetProcessTids(pid, &tids)) { in get_wchan_data() [all …]
|
/system/extras/memory_replay/ |
D | File.cpp | 59 static void WaitPid(pid_t pid) { in WaitPid() argument 61 pid_t wait_pid = TEMP_FAILURE_RETRY(waitpid(pid, &wstatus, 0)); in WaitPid() 62 if (wait_pid != pid) { in WaitPid() 66 errx(1, "Unexpected pid from waitpid(): expected %d, returned %d", pid, wait_pid); in WaitPid() 87 pid_t pid; in GetUnwindInfo() local 88 if ((pid = fork()) == 0) { in GetUnwindInfo() 118 } else if (pid == -1) { in GetUnwindInfo() 121 WaitPid(pid); in GetUnwindInfo() 132 if ((pid = fork()) == 0) { in GetUnwindInfo() 163 } else if (pid == -1) { in GetUnwindInfo() [all …]
|
/system/core/logd/ |
D | LogStatistics.h | 82 std::unique_ptr<const TEntry* []> sort(uid_t uid, pid_t pid, in sort() argument 98 if (pid && entry.getPid() && (pid != entry.getPid())) { in sort() 174 std::string format(const LogStatistics& stat, uid_t uid, pid_t pid, 180 sort(uid, pid, maximum_sorted_entries); 280 pid_t pid; member 285 pid(element->getPid()) { in UidEntry() 295 return pid; in getPid() 299 if (pid != element->getPid()) { in add() 300 pid = -1; in add() 310 uid_t pidToUid(pid_t pid); [all …]
|
/system/core/libprocessgroup/ |
D | processgroup.cpp | 118 bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector<std::string>& profiles) { in SetProcessProfiles() argument 119 return TaskProfiles::GetInstance().SetProcessProfiles(uid, pid, profiles); in SetProcessProfiles() 130 static std::string ConvertUidPidToPath(const char* cgroup, uid_t uid, int pid) { in ConvertUidPidToPath() argument 131 return StringPrintf("%s/uid_%d/pid_%d", cgroup, uid, pid); in ConvertUidPidToPath() 134 static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid) { in RemoveProcessGroup() argument 137 auto uid_pid_path = ConvertUidPidToPath(cgroup, uid, pid); in RemoveProcessGroup() 251 pid_t pid; in DoKillProcessGroupOnce() local 253 while (fscanf(fd.get(), "%d\n", &pid) == 1 && pid >= 0) { in DoKillProcessGroupOnce() 255 if (pid == 0) { in DoKillProcessGroupOnce() 261 pid_t pgid = getpgid(pid); in DoKillProcessGroupOnce() [all …]
|
/system/core/liblog/ |
D | logger_read.cpp | 41 log_time start, pid_t pid) { in android_logger_list_alloc_internal() argument 50 logger_list->pid = pid; in android_logger_list_alloc_internal() 55 struct logger_list* android_logger_list_alloc(int mode, unsigned int tail, pid_t pid) { in android_logger_list_alloc() argument 56 return android_logger_list_alloc_internal(mode, tail, log_time(0, 0), pid); in android_logger_list_alloc() 59 struct logger_list* android_logger_list_alloc_time(int mode, log_time start, pid_t pid) { in android_logger_list_alloc_time() argument 60 return android_logger_list_alloc_internal(mode, 0, start, pid); in android_logger_list_alloc_time() 78 pid_t pid) { in android_logger_list_open() argument 79 struct logger_list* logger_list = android_logger_list_alloc(mode, tail, pid); in android_logger_list_open()
|
/system/tools/hidl/test/hidl_test/ |
D | hidl_test_servers.cpp | 53 pid_t pid; in run() local 55 if ((pid = fork()) == 0) { in run() 62 gPidList.push_back({serviceName, pid}); in run() 66 static void killServer(pid_t pid, const char *serverName) { in killServer() argument 67 if (kill(pid, SIGTERM)) { in killServer() 72 waitpid(pid, &status, 0); in killServer()
|