diff options
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/containers/psgo/README.md | 2 | ||||
-rw-r--r-- | vendor/github.com/containers/psgo/internal/process/process.go | 23 | ||||
-rw-r--r-- | vendor/github.com/containers/psgo/psgo.go | 14 | ||||
-rw-r--r-- | vendor/github.com/containers/storage/VERSION | 2 | ||||
-rw-r--r-- | vendor/github.com/containers/storage/drivers/overlay/overlay.go | 9 | ||||
-rw-r--r-- | vendor/github.com/containers/storage/layers.go | 6 | ||||
-rw-r--r-- | vendor/github.com/containers/storage/pkg/tarlog/tarlogger.go | 16 | ||||
-rw-r--r-- | vendor/github.com/containers/storage/store.go | 11 | ||||
-rw-r--r-- | vendor/modules.txt | 4 |
9 files changed, 50 insertions, 37 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) diff --git a/vendor/github.com/containers/storage/VERSION b/vendor/github.com/containers/storage/VERSION index 42cf0675c..f2380cc7a 100644 --- a/vendor/github.com/containers/storage/VERSION +++ b/vendor/github.com/containers/storage/VERSION @@ -1 +1 @@ -1.15.2 +1.15.3 diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go index 13cd65fa5..16549e88b 100644 --- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go +++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go @@ -676,9 +676,6 @@ func (d *Driver) getLower(parent string) (string, error) { parentLowers := strings.Split(string(parentLower), ":") lowers = append(lowers, parentLowers...) } - if len(lowers) > maxDepth { - return "", errors.New("max depth exceeded") - } return strings.Join(lowers, ":"), nil } @@ -828,6 +825,10 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO if err != nil && !os.IsNotExist(err) { return "", err } + splitLowers := strings.Split(string(lowers), ":") + if len(splitLowers) > maxDepth { + return "", errors.New("max depth exceeded") + } // absLowers is the list of lowers as absolute paths, which works well with additional stores. absLowers := []string{} @@ -851,7 +852,7 @@ func (d *Driver) get(id string, disableShifting bool, options graphdriver.MountO // For each lower, resolve its path, and append it and any additional diffN // directories to the lowers list. - for _, l := range strings.Split(string(lowers), ":") { + for _, l := range splitLowers { if l == "" { continue } diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go index ac905b0b4..3db94e880 100644 --- a/vendor/github.com/containers/storage/layers.go +++ b/vendor/github.com/containers/storage/layers.go @@ -475,7 +475,7 @@ func (r *layerStore) saveMounts() error { return r.loadMounts() } -func newLayerStore(rundir string, layerdir string, driver drivers.Driver, uidMap, gidMap []idtools.IDMap) (LayerStore, error) { +func (s *store) newLayerStore(rundir string, layerdir string, driver drivers.Driver) (LayerStore, error) { if err := os.MkdirAll(rundir, 0700); err != nil { return nil, err } @@ -501,8 +501,8 @@ func newLayerStore(rundir string, layerdir string, driver drivers.Driver, uidMap byid: make(map[string]*Layer), bymount: make(map[string]*Layer), byname: make(map[string]*Layer), - uidMap: copyIDMap(uidMap), - gidMap: copyIDMap(gidMap), + uidMap: copyIDMap(s.uidMap), + gidMap: copyIDMap(s.gidMap), } if err := rlstore.Load(); err != nil { return nil, err diff --git a/vendor/github.com/containers/storage/pkg/tarlog/tarlogger.go b/vendor/github.com/containers/storage/pkg/tarlog/tarlogger.go index c6985d757..26cd8504c 100644 --- a/vendor/github.com/containers/storage/pkg/tarlog/tarlogger.go +++ b/vendor/github.com/containers/storage/pkg/tarlog/tarlogger.go @@ -11,7 +11,6 @@ import ( type tarLogger struct { writer *io.PipeWriter closeMutex *sync.Mutex - stateMutex *sync.Mutex closed bool } @@ -22,7 +21,6 @@ func NewLogger(logger func(*tar.Header)) (io.WriteCloser, error) { t := &tarLogger{ writer: writer, closeMutex: new(sync.Mutex), - stateMutex: new(sync.Mutex), closed: false, } tr := tar.NewReader(reader) @@ -35,12 +33,9 @@ func NewLogger(logger func(*tar.Header)) (io.WriteCloser, error) { } // Make sure to avoid writes after the reader has been closed. - t.stateMutex.Lock() - t.closed = true if err := reader.Close(); err != nil { logrus.Errorf("error closing tarlogger reader: %v", err) } - t.stateMutex.Unlock() // Unblock the Close(). t.closeMutex.Unlock() }() @@ -48,16 +43,19 @@ func NewLogger(logger func(*tar.Header)) (io.WriteCloser, error) { } func (t *tarLogger) Write(b []byte) (int, error) { - t.stateMutex.Lock() if t.closed { // We cannot use os.Pipe() as this alters the tar's digest. Using // io.Pipe() requires this workaround as it does not allow for writes // after close. - t.stateMutex.Unlock() return len(b), nil } - t.stateMutex.Unlock() - return t.writer.Write(b) + n, err := t.writer.Write(b) + if err == io.ErrClosedPipe { + // The pipe got closed. Track it and avoid to call Write in future. + t.closed = true + return len(b), nil + } + return n, err } func (t *tarLogger) Close() error { diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go index 654e86880..65808b8a0 100644 --- a/vendor/github.com/containers/storage/store.go +++ b/vendor/github.com/containers/storage/store.go @@ -667,15 +667,6 @@ func (s *store) load() error { s.graphDriverName = driver.String() driverPrefix := s.graphDriverName + "-" - rls, err := s.LayerStore() - if err != nil { - return err - } - s.layerStore = rls - if _, err := s.ROLayerStores(); err != nil { - return err - } - gipath := filepath.Join(s.graphRoot, driverPrefix+"images") if err := os.MkdirAll(gipath, 0700); err != nil { return err @@ -774,7 +765,7 @@ func (s *store) LayerStore() (LayerStore, error) { if err := os.MkdirAll(glpath, 0700); err != nil { return nil, err } - rls, err := newLayerStore(rlpath, glpath, driver, s.uidMap, s.gidMap) + rls, err := s.newLayerStore(rlpath, glpath, driver) if err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 5a17ebd78..580b4e8cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -117,7 +117,7 @@ github.com/containers/image/v5/types github.com/containers/image/v5/version # github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b github.com/containers/libtrust -# github.com/containers/psgo v1.3.2 +# github.com/containers/psgo v1.4.0 github.com/containers/psgo github.com/containers/psgo/internal/capabilities github.com/containers/psgo/internal/cgroups @@ -125,7 +125,7 @@ github.com/containers/psgo/internal/dev github.com/containers/psgo/internal/host github.com/containers/psgo/internal/proc github.com/containers/psgo/internal/process -# github.com/containers/storage v1.15.2 +# github.com/containers/storage v1.15.3 github.com/containers/storage github.com/containers/storage/drivers github.com/containers/storage/drivers/aufs |