1 /* The wrapper of clone3. 2 Copyright (C) 2021-2022 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library. If not, see 17 <https://www.gnu.org/licenses/>. */ 18 19 #ifndef _CLONE3_H 20 #define _CLONE3_H 1 21 22 #include <features.h> 23 #include <stddef.h> 24 #include <bits/types.h> 25 26 __BEGIN_DECLS 27 28 /* The unsigned 64-bit and 8-byte aligned integer type. */ 29 typedef __U64_TYPE __aligned_uint64_t __attribute__ ((__aligned__ (8))); 30 31 /* This struct should only be used in an argument to the clone3 system 32 call (along with its size argument). It may be extended with new 33 fields in the future. */ 34 35 struct clone_args 36 { 37 /* Flags bit mask. */ 38 __aligned_uint64_t flags; 39 /* Where to store PID file descriptor (pid_t *). */ 40 __aligned_uint64_t pidfd; 41 /* Where to store child TID, in child's memory (pid_t *). */ 42 __aligned_uint64_t child_tid; 43 /* Where to store child TID, in parent's memory (int *). */ 44 __aligned_uint64_t parent_tid; 45 /* Signal to deliver to parent on child termination */ 46 __aligned_uint64_t exit_signal; 47 /* The lowest address of stack. */ 48 __aligned_uint64_t stack; 49 /* Size of stack. */ 50 __aligned_uint64_t stack_size; 51 /* Location of new TLS. */ 52 __aligned_uint64_t tls; 53 /* Pointer to a pid_t array (since Linux 5.5). */ 54 __aligned_uint64_t set_tid; 55 /* Number of elements in set_tid (since Linux 5.5). */ 56 __aligned_uint64_t set_tid_size; 57 /* File descriptor for target cgroup of child (since Linux 5.7). */ 58 __aligned_uint64_t cgroup; 59 }; 60 61 /* The wrapper of clone3. */ 62 extern int clone3 (struct clone_args *__cl_args, size_t __size, 63 int (*__func) (void *__arg), void *__arg); 64 65 __END_DECLS 66 67 #endif /* clone3.h */ 68