[process][openbsd]: add cwd on openbsd.

pull/1649/head
shirou 10 months ago
parent 3afb2ed778
commit 57d4c8a90a

@ -68,7 +68,12 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
}
func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
return "", common.ErrNotImplementedError
mib := []int32{CTLKern, KernProcCwd, p.Pid}
buf, _, err := common.CallSyscall(mib)
if err != nil {
return "", err
}
return common.ByteToString(buf), nil
}
func (p *Process) ExeWithContext(ctx context.Context) (string, error) {

@ -14,6 +14,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)

@ -11,6 +11,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)

@ -14,6 +14,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)

@ -14,6 +14,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)

@ -14,6 +14,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)

@ -44,6 +44,7 @@ const (
KernProcProc = 8 // only return procs
KernProcPathname = 12 // path to executable
KernProcArgs = 55 // get/set arguments/proctitle
KernProcCwd = 78 // get current working directory
KernProcArgv = 1
KernProcEnv = 3
)

Loading…
Cancel
Save