Documentation ¶
Index ¶
- Constants
- func ForkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
- func GetPipe() ([]uintptr, error)
- func Pipe2(p []int, flags int) (err error)
- func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error)
- type ExecRLimit
- type ITimerVal
- type ProcAttr
- type RLimit
- type RlimitOptions
- type SysProcAttr
- type TimeVal
Constants ¶
View Source
const ( ITimerReal = 0 ITimerVirtual = 1 ITimerProf = 2 )
定义ITimer的常量
View Source
const DarwinSafeStackSize = 65500
DarwinSafeStackSize darwin safe stack size
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecRLimit ¶
type ExecRLimit struct { TimeLimit int // 时间限制 (ms) RealTimeLimit int // 真实时间限制 (ms, 触发SIGALRM) MemoryLimit int // 内存限制 (KB) FileSizeLimit int // 文件读写限制 (B) StackLimit int // 栈大小限制 (KB,0表示用内存限制的值,-1表示不限制,建议设置为2倍。Mac下有坑,不要去设置。) }
ExecRLimit Exec rlimit options
type ProcAttr ¶
type ProcAttr struct { Dir string // Current working directory. Env []string // Environment. Files []uintptr // File descriptors. Sys *SysProcAttr }
ProcAttr holds attributes that will be applied to a new process started by StartProcess.
type RlimitOptions ¶
RlimitOptions rlimit options
func GetRlimitOptions ¶
func GetRlimitOptions(sysRlimit *ExecRLimit) *RlimitOptions
GetRlimitOptions 解析ExecRLimit结构体并获取setrlimit操作需要的信息
type SysProcAttr ¶
type SysProcAttr struct { Chroot string // Chroot. Credential *syscall.Credential // Credential. // Ptrace tells the child to call ptrace(PTRACE_TRACEME). // Call runtime.LockOSThread before starting a process with this set, // and don't call UnlockOSThread until done with PtraceSyscall calls. Ptrace bool Setsid bool // Create session. // Setpgid sets the process group ID of the child to Pgid, // or, if Pgid == 0, to the new child's process ID. Setpgid bool // Setctty sets the controlling terminal of the child to // file descriptor Ctty. Ctty must be a descriptor number // in the child process: an index into ProcAttr.Files. // This is only meaningful if Setsid is true. Setctty bool Noctty bool // Detach fd 0 from controlling terminal Ctty int // Controlling TTY fd // Foreground places the child process group in the foreground. // This implies Setpgid. The Ctty field must be set to // the descriptor of the controlling TTY. // Unlike Setctty, in this case Ctty must be a descriptor // number in the parent process. Foreground bool Pgid int // Child's process group ID if Setpgid. Pdeathsig syscall.Signal // Signal that the process will get when its parent dies (Linux only) Cloneflags uintptr // Flags for clone calls (Linux only) UidMappings []syscall.SysProcIDMap // User ID mappings for user namespaces. GidMappings []syscall.SysProcIDMap // Group ID mappings for user namespaces. // GidMappingsEnableSetgroups enabling setgroups syscall. // If false, then setgroups syscall will be disabled for the child process. // This parameter is no-op if GidMappings == nil. Otherwise for unprivileged // users this should be set to false for mappings work. GidMappingsEnableSetgroups bool AmbientCaps []uintptr // Ambient capabilities (Linux only) Rlimit ExecRLimit // Set child's rlimit. }
Click to show internal directories.
Click to hide internal directories.