1// +build !windows
2
3/*
4   Copyright The containerd Authors.
5
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10       http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17*/
18
19package proc
20
21import (
22	"context"
23
24	"github.com/containerd/console"
25	"github.com/containerd/containerd/runtime/proc"
26	google_protobuf "github.com/gogo/protobuf/types"
27	"github.com/pkg/errors"
28)
29
30type deletedState struct {
31}
32
33func (s *deletedState) Pause(ctx context.Context) error {
34	return errors.Errorf("cannot pause a deleted process")
35}
36
37func (s *deletedState) Resume(ctx context.Context) error {
38	return errors.Errorf("cannot resume a deleted process")
39}
40
41func (s *deletedState) Update(context context.Context, r *google_protobuf.Any) error {
42	return errors.Errorf("cannot update a deleted process")
43}
44
45func (s *deletedState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
46	return errors.Errorf("cannot checkpoint a deleted process")
47}
48
49func (s *deletedState) Resize(ws console.WinSize) error {
50	return errors.Errorf("cannot resize a deleted process")
51}
52
53func (s *deletedState) Start(ctx context.Context) error {
54	return errors.Errorf("cannot start a deleted process")
55}
56
57func (s *deletedState) Delete(ctx context.Context) error {
58	return errors.Errorf("cannot delete a deleted process")
59}
60
61func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
62	return errors.Errorf("cannot kill a deleted process")
63}
64
65func (s *deletedState) SetExited(status int) {
66	// no op
67}
68
69func (s *deletedState) Exec(ctx context.Context, path string, r *ExecConfig) (proc.Process, error) {
70	return nil, errors.Errorf("cannot exec in a deleted state")
71}
72
73func (s *deletedState) Pid() int {
74	return -1
75}
76