1/*
2   Copyright The containerd Authors.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17package process
18
19import (
20	"context"
21	"io"
22	"time"
23
24	"github.com/containerd/console"
25	"github.com/containerd/containerd/pkg/stdio"
26)
27
28// Process on a system
29type Process interface {
30	// ID returns the id for the process
31	ID() string
32	// Pid returns the pid for the process
33	Pid() int
34	// ExitStatus returns the exit status
35	ExitStatus() int
36	// ExitedAt is the time the process exited
37	ExitedAt() time.Time
38	// Stdin returns the process STDIN
39	Stdin() io.Closer
40	// Stdio returns io information for the container
41	Stdio() stdio.Stdio
42	// Status returns the process status
43	Status(context.Context) (string, error)
44	// Wait blocks until the process has exited
45	Wait()
46	// Resize resizes the process console
47	Resize(ws console.WinSize) error
48	// Start execution of the process
49	Start(context.Context) error
50	// Delete deletes the process and its resourcess
51	Delete(context.Context) error
52	// Kill kills the process
53	Kill(context.Context, uint32, bool) error
54	// SetExited sets the exit status for the process
55	SetExited(status int)
56}
57