Fix lint issues on init process
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
33fe5c1d22
commit
9abde39bf7
@ -29,6 +29,7 @@ import (
|
|||||||
// InitPidFile name of the file that contains the init pid
|
// InitPidFile name of the file that contains the init pid
|
||||||
const InitPidFile = "init.pid"
|
const InitPidFile = "init.pid"
|
||||||
|
|
||||||
|
// Init represents an initial process for a container
|
||||||
type Init struct {
|
type Init struct {
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
initState
|
initState
|
||||||
@ -217,30 +218,36 @@ func New(context context.Context, path, workDir, runtimeRoot, namespace, criu st
|
|||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for the process to exit
|
||||||
func (p *Init) Wait() {
|
func (p *Init) Wait() {
|
||||||
<-p.waitBlock
|
<-p.waitBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ID of the process
|
||||||
func (p *Init) ID() string {
|
func (p *Init) ID() string {
|
||||||
return p.id
|
return p.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pid of the process
|
||||||
func (p *Init) Pid() int {
|
func (p *Init) Pid() int {
|
||||||
return p.pid
|
return p.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExitStatus of the process
|
||||||
func (p *Init) ExitStatus() int {
|
func (p *Init) ExitStatus() int {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
return p.status
|
return p.status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExitedAt at time when the process exited
|
||||||
func (p *Init) ExitedAt() time.Time {
|
func (p *Init) ExitedAt() time.Time {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
return p.exited
|
return p.exited
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Status of the process
|
||||||
func (p *Init) Status(ctx context.Context) (string, error) {
|
func (p *Init) Status(ctx context.Context) (string, error) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
@ -321,6 +328,7 @@ func (p *Init) kill(context context.Context, signal uint32, all bool) error {
|
|||||||
return checkKillError(err)
|
return checkKillError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KillAll processes belonging to the init process
|
||||||
func (p *Init) KillAll(context context.Context) error {
|
func (p *Init) KillAll(context context.Context) error {
|
||||||
err := p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
|
err := p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
|
||||||
All: true,
|
All: true,
|
||||||
@ -328,6 +336,7 @@ func (p *Init) KillAll(context context.Context) error {
|
|||||||
return p.runtimeError(err, "OCI runtime killall failed")
|
return p.runtimeError(err, "OCI runtime killall failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stdin of the process
|
||||||
func (p *Init) Stdin() io.Closer {
|
func (p *Init) Stdin() io.Closer {
|
||||||
return p.stdin
|
return p.stdin
|
||||||
}
|
}
|
||||||
@ -404,6 +413,7 @@ func (p *Init) update(context context.Context, r *shimapi.UpdateTaskRequest) err
|
|||||||
return p.runtime.Update(context, p.id, &resources)
|
return p.runtime.Update(context, p.id, &resources)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stdio of the process
|
||||||
func (p *Init) Stdio() Stdio {
|
func (p *Init) Stdio() Stdio {
|
||||||
return p.stdio
|
return p.stdio
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user