MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / getProcessIds

Method getProcessIds

src/os_linux.cpp:489–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489int OS::getProcessIds(int* pids, int max_pids) {
490 int count = 0;
491 DIR* proc = opendir("/proc");
492 if (!proc) return 0;
493
494 for (dirent* de; (de = readdir(proc)) && count < max_pids;) {
495 int pid = atoi(de->d_name);
496 if (pid > 0) {
497 pids[count++] = pid;
498 }
499 }
500
501 closedir(proc);
502 return count;
503}
504
505static bool readProcessCmdline(int pid, ProcessInfo* info) {
506 char path[64];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected