summaryrefslogtreecommitdiff
path: root/vendor/github.com
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2019-12-11 01:20:33 +0000
committerValentin Rothberg <rothberg@redhat.com>2019-12-11 10:47:21 +0100
commit594189475739a64db5d660896af28775e672b2a8 (patch)
treec4ab2f9516a9792a44759f8a7afb45190221de5b /vendor/github.com
parent282787f1fffeeda73d22987e74fae837536e9d26 (diff)
downloadpodman-594189475739a64db5d660896af28775e672b2a8.tar.gz
podman-594189475739a64db5d660896af28775e672b2a8.tar.bz2
podman-594189475739a64db5d660896af28775e672b2a8.zip
build(deps): bump github.com/containers/psgo from 1.3.2 to 1.4.0
Bumps [github.com/containers/psgo](https://github.com/containers/psgo) from 1.3.2 to 1.4.0. - [Release notes](https://github.com/containers/psgo/releases) - [Commits](https://github.com/containers/psgo/compare/v1.3.2...v1.4.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/containers/psgo/README.md2
-rw-r--r--vendor/github.com/containers/psgo/internal/process/process.go23
-rw-r--r--vendor/github.com/containers/psgo/psgo.go14
3 files changed, 31 insertions, 8 deletions
diff --git a/vendor/github.com/containers/psgo/README.md b/vendor/github.com/containers/psgo/README.md
index 55cb73a71..fed42c683 100644
--- a/vendor/github.com/containers/psgo/README.md
+++ b/vendor/github.com/containers/psgo/README.md
@@ -85,6 +85,8 @@ The ps library is compatible with all AIX format descriptors of the ps command-l
- Seccomp mode of the process (i.e., disabled, strict or filter). See seccomp(2) for more information.
- **state**
- Process state codes (e.g, **R** for *running*, **S** for *sleeping*). See proc(5) for more information.
+- **stime**
+ - Process start time (e.g, "2019-12-09 10:50:36 +0100 CET).
We can try out different format descriptors with the psgo binary:
diff --git a/vendor/github.com/containers/psgo/internal/process/process.go b/vendor/github.com/containers/psgo/internal/process/process.go
index 20e40163f..a936cc4ef 100644
--- a/vendor/github.com/containers/psgo/internal/process/process.go
+++ b/vendor/github.com/containers/psgo/internal/process/process.go
@@ -188,23 +188,30 @@ func (p *Process) SetHostData() error {
// ElapsedTime returns the time.Duration since process p was created.
func (p *Process) ElapsedTime() (time.Duration, error) {
- sinceBoot, err := strconv.ParseInt(p.Stat.Starttime, 10, 64)
+ startTime, err := p.StartTime()
if err != nil {
return 0, err
}
+ return (time.Now()).Sub(startTime), nil
+}
+
+// StarTime returns the time.Time when process p was started.
+func (p *Process) StartTime() (time.Time, error) {
+ sinceBoot, err := strconv.ParseInt(p.Stat.Starttime, 10, 64)
+ if err != nil {
+ return time.Time{}, err
+ }
clockTicks, err := host.ClockTicks()
if err != nil {
- return 0, err
+ return time.Time{}, err
}
-
- sinceBoot = sinceBoot / clockTicks
-
bootTime, err := host.BootTime()
if err != nil {
- return 0, err
+ return time.Time{}, err
}
- created := time.Unix(sinceBoot+bootTime, 0)
- return (time.Now()).Sub(created), nil
+
+ sinceBoot = sinceBoot / clockTicks
+ return time.Unix(sinceBoot+bootTime, 0), nil
}
// CPUTime returns the cumlative CPU time of process p as a time.Duration.
diff --git a/vendor/github.com/containers/psgo/psgo.go b/vendor/github.com/containers/psgo/psgo.go
index 4986c9c71..30b8b74ce 100644
--- a/vendor/github.com/containers/psgo/psgo.go
+++ b/vendor/github.com/containers/psgo/psgo.go
@@ -310,6 +310,11 @@ var (
header: "STATE",
procFn: processState,
},
+ {
+ normal: "stime",
+ header: "STIME",
+ procFn: processStartTime,
+ },
}
)
@@ -715,6 +720,15 @@ func processTIME(p *process.Process, ctx *psContext) (string, error) {
return fmt.Sprintf("%v", cpu), nil
}
+// processStartTime returns the start time of process p.
+func processStartTime(p *process.Process, ctx *psContext) (string, error) {
+ sTime, err := p.StartTime()
+ if err != nil {
+ return "", err
+ }
+ return fmt.Sprintf("%v", sTime), nil
+}
+
// processTTY returns the controlling tty (terminal) of process p.
func processTTY(p *process.Process, ctx *psContext) (string, error) {
ttyNr, err := strconv.ParseUint(p.Stat.TtyNr, 10, 64)