Skip to content

Commit

Permalink
Add support for getting process exe in FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
Donal Hurley committed Mar 9, 2023
1 parent dda567e commit cf25de7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion process/process_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
}

func (p *Process) ExeWithContext(ctx context.Context) (string, error) {
return "", common.ErrNotImplementedError
mib := []int32{CTLKern, KernProc, KernProcPathname, p.Pid}
buf, _, err := common.CallSyscall(mib)
if err != nil {
return "", err
}

return strings.Trim(string(buf), "\x00"), nil
}

func (p *Process) CmdlineWithContext(ctx context.Context) (string, error) {
Expand Down

0 comments on commit cf25de7

Please sign in to comment.