I use sysctl () function to get the process list,but I only find start time,name.how can I get more info from per process?
Asked
Active
Viewed 326 times
1 Answers
1
Also see Detect which app is currently running on iOS using sysctl for details. You basically use sysctl again to request more information about a specific PID.
struct kinfo_proc *proc;
int mib[5] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pidNum, 0 };
int count;
size_t size = 0;
// ask the proc size
if(sysctl(mib, 4, NULL, &size, NULL, 0) < 0) return -1;
// allocate memory for proc
proc = (struct kinfo_proc *)malloc(size);
sysctl(mib, 4, proc, &size, NULL, 0);

Community
- 1
- 1

hackerdiehack
- 372
- 3
- 11