github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/pkg/abi/linux/clone.go (about)

     1  // Copyright 2018 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package linux
    16  
    17  // Clone constants per clone(2).
    18  const (
    19  	CSIGNAL = 0xff
    20  
    21  	CLONE_VM             = 0x100
    22  	CLONE_FS             = 0x200
    23  	CLONE_FILES          = 0x400
    24  	CLONE_SIGHAND        = 0x800
    25  	CLONE_PIDFD          = 0x1000
    26  	CLONE_PTRACE         = 0x2000
    27  	CLONE_VFORK          = 0x4000
    28  	CLONE_PARENT         = 0x8000
    29  	CLONE_THREAD         = 0x10000
    30  	CLONE_NEWNS          = 0x20000
    31  	CLONE_SYSVSEM        = 0x40000
    32  	CLONE_SETTLS         = 0x80000
    33  	CLONE_PARENT_SETTID  = 0x100000
    34  	CLONE_CHILD_CLEARTID = 0x200000
    35  	CLONE_DETACHED       = 0x400000
    36  	CLONE_UNTRACED       = 0x800000
    37  	CLONE_CHILD_SETTID   = 0x1000000
    38  	CLONE_NEWCGROUP      = 0x2000000
    39  	CLONE_NEWUTS         = 0x4000000
    40  	CLONE_NEWIPC         = 0x8000000
    41  	CLONE_NEWUSER        = 0x10000000
    42  	CLONE_NEWPID         = 0x20000000
    43  	CLONE_NEWNET         = 0x40000000
    44  	CLONE_IO             = 0x80000000
    45  
    46  	// Only passable via clone3(2).
    47  	CLONE_CLEAR_SIGHAND = 0x100000000
    48  	CLONE_INTO_CGROUP   = 0x200000000
    49  
    50  	// Sizeof first published struct.
    51  	CLONE_ARGS_SIZE_VER0 = 64
    52  	// Sizeof third published struct.
    53  	CLONE_ARGS_SIZE_VER2 = 88
    54  )
    55  
    56  // CloneArgs is struct clone_args, from include/uapi/linux/sched.h.
    57  //
    58  // +marshal
    59  type CloneArgs struct {
    60  	Flags      uint64
    61  	Pidfd      uint64
    62  	ChildTID   uint64
    63  	ParentTID  uint64
    64  	ExitSignal uint64
    65  	Stack      uint64
    66  	StackSize  uint64
    67  	TLS        uint64
    68  	SetTID     uint64
    69  	SetTIDSize uint64
    70  	Cgroup     uint64
    71  }