Source
pub const ucontext_t = switch (native_os) {
.linux => linux.ucontext_t,
.emscripten => emscripten.ucontext_t,
.macos, .ios, .tvos, .watchos, .visionos => extern struct {
onstack: c_int,
sigmask: sigset_t,
stack: stack_t,
link: ?*ucontext_t,
mcsize: u64,
mcontext: *mcontext_t,
__mcontext_data: mcontext_t,
},
.freebsd => extern struct {
sigmask: sigset_t,
mcontext: mcontext_t,
link: ?*ucontext_t,
stack: stack_t,
flags: c_int,
__spare__: [4]c_int,
},
.solaris, .illumos => extern struct {
flags: u64,
link: ?*ucontext_t,
sigmask: sigset_t,
stack: stack_t,
mcontext: mcontext_t,
brand_data: [3]?*anyopaque,
filler: [2]i64,
},
.netbsd => extern struct {
flags: u32,
link: ?*ucontext_t,
sigmask: sigset_t,
stack: stack_t,
mcontext: mcontext_t,
__pad: [
switch (builtin.cpu.arch) {
.x86 => 4,
.mips, .mipsel, .mips64, .mips64el => 14,
.arm, .armeb, .thumb, .thumbeb => 1,
.sparc, .sparc64 => if (@sizeOf(usize) == 4) 43 else 8,
else => 0,
}
]u32,
},
.dragonfly => extern struct {
sigmask: sigset_t,
mcontext: mcontext_t,
link: ?*ucontext_t,
stack: stack_t,
cofunc: ?*fn (?*ucontext_t, ?*anyopaque) void,
arg: ?*void,
_spare: [4]c_int,
},
// https://github.com/SerenityOS/serenity/blob/87eac0e424cff4a1f941fb704b9362a08654c24d/Kernel/API/POSIX/ucontext.h#L19-L24
.haiku, .serenity => extern struct {
link: ?*ucontext_t,
sigmask: sigset_t,
stack: stack_t,
mcontext: mcontext_t,
},
.openbsd => openbsd.ucontext_t,
else => void,
}