The Pedigree Project 0.1
linux-clone-abi.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef PEDIGREE_POSIX_LINUX_CLONE_ABI_H
3#define PEDIGREE_POSIX_LINUX_CLONE_ABI_H
4
5#include <stddef.h>
6#include <stdint.h>
7
9 uint64_t flags;
10 uint64_t pidfd;
11 uint64_t child_tid;
12 uint64_t parent_tid;
13 uint64_t exit_signal;
14 uint64_t stack;
15 uint64_t stack_size;
16 uint64_t tls;
17 uint64_t set_tid;
18 uint64_t set_tid_size;
19 uint64_t cgroup;
20};
21
22namespace LinuxCloneAbi {
23constexpr size_t Version0Size = 64;
24constexpr size_t Version1Size = 80;
25constexpr size_t Version2Size = 88;
26constexpr size_t MaximumSize = 4096;
27constexpr uint64_t ClearSighand = 1ULL << 32;
28} // namespace LinuxCloneAbi
29
30static_assert(sizeof(LinuxCloneArgs) == LinuxCloneAbi::Version2Size,
31 "Linux amd64 clone_args must remain 88 bytes");
32static_assert(offsetof(LinuxCloneArgs, set_tid) == LinuxCloneAbi::Version0Size &&
33 offsetof(LinuxCloneArgs, cgroup) == LinuxCloneAbi::Version1Size,
34 "Linux clone_args version boundaries changed");
35static_assert(offsetof(LinuxCloneArgs, child_tid) == 16 &&
36 offsetof(LinuxCloneArgs, parent_tid) == 24 &&
37 offsetof(LinuxCloneArgs, exit_signal) == 32 &&
38 offsetof(LinuxCloneArgs, stack) == 40 &&
39 offsetof(LinuxCloneArgs, stack_size) == 48 && offsetof(LinuxCloneArgs, tls) == 56,
40 "Linux clone_args field offsets changed");
41
42#endif