vendor containers/psgo@v1.8.0

Signed-off-by: Piotr Resztak <piotr.resztak@gmail.com>
This commit is contained in:
Piotr Resztak
2022-10-12 23:05:28 +02:00
parent b712736bd2
commit 04c126a3b4
6 changed files with 57 additions and 5 deletions

View File

@ -83,6 +83,8 @@ The ps library is compatible with all AIX format descriptors of the ps command-l
- The corresponding host PID of a container process.
- **huser**
- The corresponding effective user of a container process on the host.
- **huid**
- The corresponding host UID of a container process.
- **label**
- Current security attributes of the process.
- **seccomp**

View File

@ -181,6 +181,11 @@ var (
header: "USER",
procFn: processUSER,
},
{
normal: "uid",
header: "UID",
procFn: processUID,
},
{
code: "%a",
normal: "args",
@ -294,6 +299,12 @@ var (
onHost: true,
procFn: processHUSER,
},
{
normal: "huid",
header: "HUID",
onHost: true,
procFn: processHUID,
},
{
normal: "hgroup",
header: "HGROUP",
@ -648,6 +659,11 @@ func processUSER(p *process.Process, ctx *psContext) (string, error) {
return process.LookupUID(p.Status.Uids[1])
}
// processUID returns the effective UID of the process as the decimal representation.
func processUID(p *process.Process, ctx *psContext) (string, error) {
return p.Status.Uids[1], nil
}
// processRUSER returns the effective user name of the process. This will be
// the textual user ID, if it can be obtained, or a decimal representation
// otherwise.
@ -857,6 +873,23 @@ func processHUSER(p *process.Process, ctx *psContext) (string, error) {
return "?", nil
}
// processHUID returns the effective UID of the corresponding host process
// of the (container) as the decimal representation or "?" if no corresponding
// process could be found.
func processHUID(p *process.Process, ctx *psContext) (string, error) {
if hp := findHostProcess(p, ctx); hp != nil {
if ctx.opts != nil && len(ctx.opts.UIDMap) > 0 {
// Return uid without searching its textual representation.
lookupFunc := func(uid string) (string, error) {
return uid, nil
}
return findID(hp.Status.Uids[1], ctx.opts.UIDMap, lookupFunc, "/proc/sys/fs/overflowuid")
}
return hp.Status.Uids[1], nil
}
return "?", nil
}
// processHGROUP returns the effective group ID of the corresponding host
// process of the (container) or "?" if no corresponding process could be
// found.