Home
last modified time | relevance | path

Searched refs:pid (Results 1 – 25 of 457) sorted by relevance

12345678910>>...19

/system/core/libunwindstack/tests/
DMemoryRemoteTest.cpp44 pid_t pid; in TEST() local
45 if ((pid = fork()) == 0) { in TEST()
49 ASSERT_LT(0, pid); in TEST()
50 TestScopedPidReaper reap(pid); in TEST()
52 ASSERT_TRUE(TestAttach(pid)); in TEST()
54 MemoryRemote remote(pid); in TEST()
62 ASSERT_TRUE(TestDetach(pid)); in TEST()
72 pid_t pid; in TEST() local
73 if ((pid = fork()) == 0) { in TEST()
78 ASSERT_LT(0, pid); in TEST()
[all …]
DUnwindTest.cpp129 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 …]
DTestUtils.h30 TestScopedPidReaper(pid_t pid) : pid_(pid) {} in TestScopedPidReaper() argument
40 inline bool TestQuiescePid(pid_t pid) { in TestQuiescePid() argument
45 if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) { in TestQuiescePid()
54 inline bool TestAttach(pid_t pid) { in TestAttach() argument
55 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { in TestAttach()
59 return TestQuiescePid(pid); in TestAttach()
62 inline bool TestDetach(pid_t pid) { in TestDetach() argument
63 return ptrace(PTRACE_DETACH, pid, 0, 0) == 0; in TestDetach()
DMemoryMteTest.cpp60 pid_t pid; in TEST() local
61 if ((pid = fork()) == 0) { in TEST()
66 ASSERT_LT(0, pid); in TEST()
67 TestScopedPidReaper reap(pid); in TEST()
69 ASSERT_TRUE(TestAttach(pid)); in TEST()
71 MemoryRemote remote(pid); in TEST()
76 ASSERT_TRUE(TestDetach(pid)); in TEST()
/system/extras/ioshark/
Dcompile-only.sh39 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 …]
Dcollect-straces-ftraces.sh41 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/
Dbacktrace_read_benchmarks.cpp39 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 …]
Dbacktrace_test.cpp135 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 …]
/system/core/libunwindstack/tools/
Dunwind.cpp37 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/
Dlmkd_service.cpp37 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 …]
Dsigchld_handler.cpp54 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/
Ddmabuf_dump.cpp49 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/lmkd/
Dstatslog.cpp40 int pid; member
63 static struct proc* pid_lookup(int pid) { in pid_lookup() argument
68 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid; procp = procp->pidhash_next) in pid_lookup()
101 int stats_write_lmk_kill_occurred_pid(int32_t uid, int pid, int32_t oom_score, in stats_write_lmk_kill_occurred_pid() argument
104 struct proc* proc = pid_lookup(pid); in stats_write_lmk_kill_occurred_pid()
133 static int memory_stat_from_cgroup(struct memory_stat* mem_st, int pid, uid_t uid) { in memory_stat_from_cgroup() argument
137 snprintf(buf, sizeof(buf), MEMCG_PROCESS_MEMORY_STAT_PATH, uid, pid); in memory_stat_from_cgroup()
153 static int memory_stat_from_procfs(struct memory_stat* mem_st, int pid) { in memory_stat_from_procfs() argument
158 snprintf(path, sizeof(path), PROC_STAT_FILE_PATH, pid); in memory_stat_from_procfs()
190 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid) { in stats_read_memory_stat() argument
[all …]
Dstatslog.h68 int stats_write_lmk_kill_occurred_pid(int32_t uid, int pid, int32_t oom_score,
72 struct memory_stat *stats_read_memory_stat(bool per_app_memcg, int pid, uid_t uid);
77 void stats_store_taskname(int pid, const char* taskname);
87 void stats_remove_taskname(int pid);
101 int pid __unused, int32_t oom_score __unused, in stats_write_lmk_kill_occurred_pid()
109 int pid __unused, uid_t uid __unused) { return NULL; } in stats_read_memory_stat()
111 static inline void stats_store_taskname(int pid __unused, const char* taskname __unused) {} in stats_store_taskname()
115 static inline void stats_remove_taskname(int pid __unused) {} in stats_remove_taskname()
/system/memory/libmeminfo/libdmabufinfo/
Ddmabufinfo_test.cpp65 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 …]
Ddmabufinfo.cpp46 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/libmemtrack/
Dmemtrack_test.cpp32 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/
Ddebuggerd.cpp77 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/memory/libmeminfo/libdmabufinfo/include/dmabufinfo/
Ddmabufinfo.h41 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/extras/memory_replay/
DFile.cpp59 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/libprocessgroup/
Dprocessgroup.cpp118 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/adb/libs/adbconnection/include/adbconnection/
Dprocess_info.h26 uint64_t pid; member
32 ProcessInfo() : pid(0), debuggable(false), profileable(false), arch_name_length(0) {} in ProcessInfo()
34 ProcessInfo(uint64_t pid, bool dbg, bool prof, const std::string& arch) in ProcessInfo()
35 : pid(pid), debuggable(dbg), profileable(prof) { in ProcessInfo()
/system/core/debuggerd/libdebuggerd/
Dbacktrace.cpp44 static void dump_process_header(log_t* log, pid_t pid, const char* process_name) { in dump_process_header() argument
45 _LOG(log, logtype::BACKTRACE, "\n\n----- pid %d at %s -----\n", pid, get_timestamp().c_str()); in dump_process_header()
53 static void dump_process_footer(log_t* log, pid_t pid) { in dump_process_footer() argument
54 _LOG(log, logtype::BACKTRACE, "\n----- end %d -----\n", pid); in dump_process_footer()
87 dump_process_header(&log, target->second.pid, target->second.process_name.c_str()); in dump_backtrace()
96 dump_process_footer(&log, target->second.pid); in dump_backtrace()
104 pid_t pid = getpid(); in dump_backtrace_header() local
105 dump_process_header(&log, pid, get_process_name(pid).c_str()); in dump_backtrace_header()
/system/core/liblog/
Dlogger_read.cpp41 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/core/debuggerd/client/
Ddebuggerd_client.cpp53 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()
77 static std::string get_wchan_data(pid_t pid) { in get_wchan_data() argument
81 if (!android::procinfo::GetProcessTids(pid, &tids)) { in get_wchan_data()
88 std::string path = "/proc/" + std::to_string(pid) + "/task/" + std::to_string(tid) + "/wchan"; in get_wchan_data()
98 buffer << "\n----- Waiting Channels: pid " << pid << " at " << get_timestamp() << " -----\n" in get_wchan_data()
99 << "Cmd line: " << get_process_name(pid) << "\n"; in get_wchan_data()
101 buffer << "----- end " << std::to_string(pid) << " -----\n"; in get_wchan_data()
108 static void dump_wchan_data(const std::string& data, int fd, pid_t pid) { in dump_wchan_data() argument
[all …]

12345678910>>...19