From cf25de74601ef1bd6dbd13366d19618001b4e87b Mon Sep 17 00:00:00 2001 From: Donal Hurley Date: Thu, 9 Mar 2023 11:46:40 +0000 Subject: [PATCH] Add support for getting process exe in FreeBSD --- process/process_freebsd.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/process/process_freebsd.go b/process/process_freebsd.go index 779f8126a..a123ccf9b 100644 --- a/process/process_freebsd.go +++ b/process/process_freebsd.go @@ -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) {