github.com/criyle/go-sandbox@v0.10.3/pkg/forkexec/runner_darwin.go (about)

     1  package forkexec
     2  
     3  import (
     4  	"github.com/criyle/go-sandbox/pkg/rlimit"
     5  )
     6  
     7  // Runner is the configuration including the exec path, argv
     8  // and resource limits.
     9  type Runner struct {
    10  	// argv and env for execve syscall for the child process
    11  	Args []string
    12  	Env  []string
    13  
    14  	// POSIX Resource limit set by set rlimit
    15  	RLimits []rlimit.RLimit
    16  
    17  	// file descriptors map for new process, from 0 to len - 1
    18  	Files []uintptr
    19  
    20  	// work path set by chdir(dir) (current working directory for child)
    21  	// if pivot_root is defined, this will execute after changed to new root
    22  	WorkDir string
    23  
    24  	// sandbox profile defines the sandbox profile for sandbox_init syscall
    25  	SandboxProfile string
    26  
    27  	// Parent and child process with sync status through a socket pair.
    28  	// SyncFunc will invoke with the child pid. If SyncFunc return some error,
    29  	// parent will signal child to stop and report the error
    30  	// SyncFunc is called right before execve, thus it could track cpu more accurately
    31  	SyncFunc func(int) error
    32  }