Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
HiGarfield committed May 3, 2024
1 parent 2ea4bd2 commit 606feef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/process_iterator_apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ int init_process_iterator(struct process_iterator *it, struct process_filter *fi

static void pti2proc(struct proc_taskallinfo *ti, struct process *process)
{
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, ti->pbsd.pbi_pid};
size_t size;
size_t size, len;
process->pid = ti->pbsd.pbi_pid;
process->ppid = ti->pbsd.pbi_ppid;
process->cputime = ti->ptinfo.pti_total_user / 1e6 + ti->ptinfo.pti_total_system / 1e6;
len = sizeof(mib) / sizeof(*mib);
sysctlnametomib("kern.proc.pid", mib, &len);
mib[3] = process->pid;
if (sysctl(mib, sizeof(mib) / sizeof(*mib), process->command, &size, NULL, 0) == -1)
{
perror("sysctl");
Expand Down

0 comments on commit 606feef

Please sign in to comment.