Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Add DragonFlyBSD support #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions process_dragonfly.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// +build dragonfly

package ps

import (
"fmt"
"io/ioutil"
)

// Refresh reloads all the data associated with this process.
func (p *UnixProcess) Refresh() error {
statPath := fmt.Sprintf("/proc/%d/status", p.pid)
dataBytes, err := ioutil.ReadFile(statPath)
if err != nil {
return err
}

data := string(dataBytes)

_, err = fmt.Sscanf(data,
"%s %d %d %d %d",
&p.binary,
&p.pid,
&p.ppid,
&p.pgrp,
&p.sid)

return err
}
2 changes: 1 addition & 1 deletion process_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build linux solaris
// +build linux solaris dragonfly

package ps

Expand Down
2 changes: 1 addition & 1 deletion process_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build linux solaris
// +build linux solaris dragonfly

package ps

Expand Down