Documentation ¶
Index ¶
- Variables
- func NewSocketPair(name string) (*os.File, *os.File, error)
- func ParseProcSync(pipe io.Reader, fn func(*ProcSync) error) error
- func ReadProcSync(r io.Reader, expected ProcSyncType) error
- func RuncExecOptsArgs(opts *runc.ExecOpts) (out []string, err error)
- func RuntimeCommand(ctx context.Context, ext bool, r *runc.Runc, args ...string) *exec.Cmd
- func WriteProcSyncMessage(w io.Writer, msg ProcSync) error
- type PidFile
- type ProcSync
- type ProcSyncType
Constants ¶
This section is empty.
Variables ¶
View Source
var EnvNameProcSyncPipe = "_RUNCEXT_PROC_SYNC_PIPE"
View Source
var RuntimeExtCommand = "embedshim-runcext"
Functions ¶
func ReadProcSync ¶
func ReadProcSync(r io.Reader, expected ProcSyncType) error
func RuncExecOptsArgs ¶
RuncExecOptsArgs is based on
func RuntimeCommand ¶
RuntimeCommand is based on github.com/containerd/go-runc@v1.0.0/command_linux.go
Types ¶
type PidFile ¶
type PidFile struct {
// contains filtered or unexported fields
}
PidFile is used to read pid from file named by --pid-file option.
func NewPidFile ¶
type ProcSync ¶
type ProcSync struct { Type ProcSyncType `json:"type"` Pid uint32 `json:"pid"` Exited bool `json:"exited"` ExitedStatus uint32 `json:"exited_status"` Message string `json:"message,omitempty"` }
func NewProcSyncErrorMessage ¶
func NewProcSyncExecPidDoneMessage ¶
func NewProcSyncExecPidDoneMessage() ProcSync
func NewProcSyncExecStatusDoneMessage ¶
func NewProcSyncExecStatusDoneMessage() ProcSync
type ProcSyncType ¶
type ProcSyncType string
ProcSyncType is used for synchronisation between parent and child process during setup containers exec processes.
Since the exec process doesn't like container init which has two-steps to setup, we need a wrapper runc-exec commandline to setup pidfd exit event monitor like what we does for runc-init.
NOTE: The design is based on runc's syncType from commit[1].
const ( ProcSyncError ProcSyncType = "error" // [ runc-exec-ext(child)] [ parent ] // // SyncExecPid --> read pid // // <-- SyncExecPidDone // // SyncExecPidStatus --> exec current status // // <-- SyncExecPidStatusDone // // NOTE: // // The commit[1] only supports pidfd type on waitid, not including // the non-parent support. We need one extra step to check exec process // is still alive. In the future, pidfd_wait[2] API can support waitid // by non-parent process. // // [1] https://github.com/torvalds/linux/commit/3695eae5fee0605f316fbaad0b9e3de791d7dfaf // [2] https://lwn.net/Articles/794707/ ProcSyncExecPid ProcSyncType = "execPid" ProcSyncExecPidDone ProcSyncType = "execPidDone" ProcSyncExecStatus ProcSyncType = "execStatus" ProcSyncExecStatusDone ProcSyncType = "execStatusDone" )
Click to show internal directories.
Click to hide internal directories.