github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/shim/proc/types.go (about)

     1  // Copyright 2018 The containerd Authors.
     2  // Copyright 2018 The gVisor 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  //     https://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  package proc
    17  
    18  import (
    19  	"time"
    20  
    21  	runc "github.com/containerd/go-runc"
    22  	"github.com/gogo/protobuf/types"
    23  )
    24  
    25  // Mount holds filesystem mount configuration.
    26  type Mount struct {
    27  	Type    string
    28  	Source  string
    29  	Target  string
    30  	Options []string
    31  }
    32  
    33  // CreateConfig hold task creation configuration.
    34  type CreateConfig struct {
    35  	ID       string
    36  	Bundle   string
    37  	Runtime  string
    38  	Rootfs   []Mount
    39  	Terminal bool
    40  	Stdin    string
    41  	Stdout   string
    42  	Stderr   string
    43  }
    44  
    45  // ExecConfig holds exec creation configuration.
    46  type ExecConfig struct {
    47  	ID       string
    48  	Terminal bool
    49  	Stdin    string
    50  	Stdout   string
    51  	Stderr   string
    52  	Spec     *types.Any
    53  }
    54  
    55  // Exit is the type of exit events.
    56  type Exit struct {
    57  	Timestamp time.Time
    58  	ID        string
    59  	Status    int
    60  }
    61  
    62  // ProcessMonitor monitors process exit changes.
    63  type ProcessMonitor interface {
    64  	// Subscribe to process exit changes
    65  	Subscribe() chan runc.Exit
    66  	// Unsubscribe to process exit changes
    67  	Unsubscribe(c chan runc.Exit)
    68  }