Skip to content

Commit 4336530

Browse files
authored
Merge pull request #1649 from shirou/feat/add_process_cwd_openbsd
[process][openbsd]: add cwd on openbsd.
2 parents cb52f7a + 57d4c8a commit 4336530

7 files changed

+12
-1
lines changed

process/process_openbsd.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ func (p *Process) NameWithContext(ctx context.Context) (string, error) {
6868
}
6969

7070
func (p *Process) CwdWithContext(ctx context.Context) (string, error) {
71-
return "", common.ErrNotImplementedError
71+
mib := []int32{CTLKern, KernProcCwd, p.Pid}
72+
buf, _, err := common.CallSyscall(mib)
73+
if err != nil {
74+
return "", err
75+
}
76+
return common.ByteToString(buf), nil
7277
}
7378

7479
func (p *Process) ExeWithContext(ctx context.Context) (string, error) {

process/process_openbsd_386.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process/process_openbsd_amd64.go

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const (
1111
KernProcProc = 8
1212
KernProcPathname = 12
1313
KernProcArgs = 55
14+
KernProcCwd = 78
1415
KernProcArgv = 1
1516
KernProcEnv = 3
1617
)

process/process_openbsd_arm.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process/process_openbsd_arm64.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process/process_openbsd_riscv64.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

process/types_openbsd.go

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
KernProcProc = 8 // only return procs
4545
KernProcPathname = 12 // path to executable
4646
KernProcArgs = 55 // get/set arguments/proctitle
47+
KernProcCwd = 78 // get current working directory
4748
KernProcArgv = 1
4849
KernProcEnv = 3
4950
)

0 commit comments

Comments
 (0)