Start work on Container and Process model
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
6641888667
commit
32bf0f69fd
38 changed files with 525 additions and 353 deletions
36
execution/executors/oci/process.go
Normal file
36
execution/executors/oci/process.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package oci
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func newProcess(pid int) (*process, error) {
|
||||
proc, err := os.FindProcess(pid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &process{
|
||||
proc: proc,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type process struct {
|
||||
proc *os.Process
|
||||
}
|
||||
|
||||
func (p *process) Pid() int {
|
||||
return p.proc.Pid
|
||||
}
|
||||
|
||||
func (p *process) Wait() (uint32, error) {
|
||||
state, err := p.proc.Wait()
|
||||
if err != nil {
|
||||
return 0, nil
|
||||
}
|
||||
return uint32(state.Sys().(syscall.WaitStatus).ExitStatus()), nil
|
||||
}
|
||||
|
||||
func (p *process) Signal(s os.Signal) error {
|
||||
return p.proc.Signal(s)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue