1/* The clone3 kernel interface definitions.
2 Copyright (C) 2021-2024 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
27/* Flags for the clone3 syscall. */
28#define CLONE_CLEAR_SIGHAND 0x100000000ULL /* Clear any signal handler and
29 reset to SIG_DFL. */
30#define CLONE_INTO_CGROUP 0x200000000ULL /* Clone into a specific cgroup given
31 the right permissions. */
32
33/* The unsigned 64-bit and 8-byte aligned integer type. */
34typedef __U64_TYPE __aligned_uint64_t __attribute__ ((__aligned__ (8)));
35
36/* This struct should only be used in an argument to the clone3 system
37 call (along with its size argument). It may be extended with new
38 fields in the future. */
39
40struct clone_args
41{
42 /* Flags bit mask. */
43 __aligned_uint64_t flags;
44 /* Where to store PID file descriptor (pid_t *). */
45 __aligned_uint64_t pidfd;
46 /* Where to store child TID, in child's memory (pid_t *). */
47 __aligned_uint64_t child_tid;
48 /* Where to store child TID, in parent's memory (int *). */
49 __aligned_uint64_t parent_tid;
50 /* Signal to deliver to parent on child termination */
51 __aligned_uint64_t exit_signal;
52 /* The lowest address of stack. */
53 __aligned_uint64_t stack;
54 /* Size of stack. */
55 __aligned_uint64_t stack_size;
56 /* Location of new TLS. */
57 __aligned_uint64_t tls;
58 /* Pointer to a pid_t array (since Linux 5.5). */
59 __aligned_uint64_t set_tid;
60 /* Number of elements in set_tid (since Linux 5.5). */
61 __aligned_uint64_t set_tid_size;
62 /* File descriptor for target cgroup of child (since Linux 5.7). */
63 __aligned_uint64_t cgroup;
64};
65
66#endif /* clone3.h */
67

source code of glibc/sysdeps/unix/sysv/linux/clone3.h