Skip to content

Commit

Permalink
[process][openbsd]: add cwd on openbsd.
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed May 14, 2024
1 parent 3afb2ed commit 57d4c8a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion process/process_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions process/process_openbsd_386.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions process/process_openbsd_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
KernProcProc = 8
KernProcPathname = 12
KernProcArgs = 55
KernProcCwd = 78
KernProcArgv = 1
KernProcEnv = 3
)
Expand Down
1 change: 1 addition & 0 deletions process/process_openbsd_arm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions process/process_openbsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions process/process_openbsd_riscv64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions process/types_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 57d4c8a

Please sign in to comment.