2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2021 Dmitry Chagin <dchagin@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #ifndef _LINUX_FORK_H_
29 #define _LINUX_FORK_H_
31 #define LINUX_CLONE_VM 0x00000100
32 #define LINUX_CLONE_FS 0x00000200
33 #define LINUX_CLONE_FILES 0x00000400
34 #define LINUX_CLONE_SIGHAND 0x00000800
35 #define LINUX_CLONE_PIDFD 0x00001000 /* since Linux 5.2 */
36 #define LINUX_CLONE_PTRACE 0x00002000
37 #define LINUX_CLONE_VFORK 0x00004000
38 #define LINUX_CLONE_PARENT 0x00008000
39 #define LINUX_CLONE_THREAD 0x00010000
40 #define LINUX_CLONE_NEWNS 0x00020000 /* New mount NS */
41 #define LINUX_CLONE_SYSVSEM 0x00040000
42 #define LINUX_CLONE_SETTLS 0x00080000
43 #define LINUX_CLONE_PARENT_SETTID 0x00100000
44 #define LINUX_CLONE_CHILD_CLEARTID 0x00200000
45 #define LINUX_CLONE_DETACHED 0x00400000 /* Unused */
46 #define LINUX_CLONE_UNTRACED 0x00800000
47 #define LINUX_CLONE_CHILD_SETTID 0x01000000
48 #define LINUX_CLONE_NEWCGROUP 0x02000000 /* New cgroup NS */
49 #define LINUX_CLONE_NEWUTS 0x04000000
50 #define LINUX_CLONE_NEWIPC 0x08000000
51 #define LINUX_CLONE_NEWUSER 0x10000000
52 #define LINUX_CLONE_NEWPID 0x20000000
53 #define LINUX_CLONE_NEWNET 0x40000000
54 #define LINUX_CLONE_IO 0x80000000
56 /* Flags for the clone3() syscall. */
57 #define LINUX_CLONE_CLEAR_SIGHAND 0x100000000ULL
58 #define LINUX_CLONE_INTO_CGROUP 0x200000000ULL
59 #define LINUX_CLONE_NEWTIME 0x00000080
61 #define LINUX_CLONE_LEGACY_FLAGS 0xffffffffULL
63 #define LINUX_CSIGNAL 0x000000ff
67 * User-space clone3 args layout.
69 struct l_user_clone_args {
79 uint64_t set_tid_size;
84 * Kernel clone3 args layout.
96 #define LINUX_CLONE_ARGS_SIZE_VER0 64
98 int linux_set_upcall(struct thread *, register_t);
99 int linux_set_cloned_tls(struct thread *, void *);
100 void linux_thread_detach(struct thread *);
101 #endif /* defined(_KERNEL) */
103 #endif /* _LINUX_FORK_H_ */