summaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/go-ps/process.go
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-01-12 18:39:45 +0100
committerRuben Pollan <meskio@sindominio.net>2019-01-17 12:30:32 +0100
commitb1247d2d0d51108c910a73891ff3116e5f032ab1 (patch)
treee9948964f0bfb1ad2df3bc7bad02aa1f41ccfbd8 /vendor/github.com/mitchellh/go-ps/process.go
parentefcb8312e31b5c2261b1a1e95ace55b322cfcc27 (diff)
[pkg] all your deps are vendored to us
Diffstat (limited to 'vendor/github.com/mitchellh/go-ps/process.go')
-rw-r--r--vendor/github.com/mitchellh/go-ps/process.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/go-ps/process.go b/vendor/github.com/mitchellh/go-ps/process.go
new file mode 100644
index 0000000..2b5e8ed
--- /dev/null
+++ b/vendor/github.com/mitchellh/go-ps/process.go
@@ -0,0 +1,40 @@
+// ps provides an API for finding and listing processes in a platform-agnostic
+// way.
+//
+// NOTE: If you're reading these docs online via GoDocs or some other system,
+// you might only see the Unix docs. This project makes heavy use of
+// platform-specific implementations. We recommend reading the source if you
+// are interested.
+package ps
+
+// Process is the generic interface that is implemented on every platform
+// and provides common operations for processes.
+type Process interface {
+ // Pid is the process ID for this process.
+ Pid() int
+
+ // PPid is the parent process ID for this process.
+ PPid() int
+
+ // Executable name running this process. This is not a path to the
+ // executable.
+ Executable() string
+}
+
+// Processes returns all processes.
+//
+// This of course will be a point-in-time snapshot of when this method was
+// called. Some operating systems don't provide snapshot capability of the
+// process table, in which case the process table returned might contain
+// ephemeral entities that happened to be running when this was called.
+func Processes() ([]Process, error) {
+ return processes()
+}
+
+// FindProcess looks up a single process by pid.
+//
+// Process will be nil and error will be nil if a matching process is
+// not found.
+func FindProcess(pid int) (Process, error) {
+ return findProcess(pid)
+}