Skip to content

Commit

Permalink
Fix build failure on FreeBSD 10.* due to KERN_PROC_CWD unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
Low-power authored and BenBE committed Aug 4, 2022
1 parent 427650a commit 3e1908b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions freebsd/FreeBSDProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ static void FreeBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process
}

static void FreeBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process* proc) {
#ifdef KERN_PROC_CWD
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_CWD, kproc->ki_pid };
char buffer[2048];
size_t size = sizeof(buffer);
Expand All @@ -414,6 +415,9 @@ static void FreeBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process
}

free_and_xStrdup(&proc->procCwd, buffer);
#else
proc->procCwd = NULL;
#endif
}

static void FreeBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) {
Expand Down

0 comments on commit 3e1908b

Please sign in to comment.