UCONTEXT(3)
UCONTEXT(3) β user thread context π
okay so this is the Library Functions Manual page for UCONTEXT(3), aka ucontext β user thread context. yes bestie, weβre talking about the little struct that holds a whole user threadβs vibe. slay.
πΈ NAME πΈ
ucontext β user thread context. thatβs the whole name section, periodt.
π LIBRARY π
Standard C Library (libc, -lc). itβs giving βlink me and letβs go.β π«Ά
β¨ SYNOPSIS β¨
#include <ucontext.h>
π¦ DESCRIPTION π¦
The ucontext_t type is a structure type suitable for holding the context for a user thread of execution. A threadβs context includes its stack, saved registers, and list of blocked signals. literally the whole little survival kit for a thread. π
The ucontext_t structure contains at least these fields β yes, at least, donβt come for me:
ucontext_t *uc_linkβ context to assume when this one returnssigset_t uc_sigmaskβ signals being blockedstack_t uc_stackβ stack areamcontext_t uc_mcontextβ saved registers
The uc_link field points to the context to resume when this contextβs entry point function returns. so if your main character entry point function dips, uc_link is the next context waiting to take over. If uc_link is equal to NULL, then the process exits when this context returns. no next context, no party, process says bye. π
The uc_mcontext field is machine-dependent and should be treated as opaque by portable applications. translation: do not peer into it like itβs a group chat screenshot; portable apps treat it as opaque. respect the mystery. π
The following functions are defined to manipulate ucontext_t structures β these are the little icons that actually do the work:
int getcontext(ucontext_t *);
ucontext_t * getcontextx(void);
int setcontext(const ucontext_t *);
void makecontext(ucontext_t *, void (*)(void), int, ...);
int swapcontext(ucontext_t *, const ucontext_t *);
π SEE ALSO π
go read these next, bestie β theyβre literally right there:
β STANDARDS β
The ucontext_t type conforms to X/Open System Interfaces and Headers Issue 5 (βXSH5β) and IEEE Std 1003.1-2001 (βPOSIX.1β). so yes, it has receipts. β¨
The IEEE Std 1003.1-2008 (βPOSIX.1β) revision removed the ucontext_t from the specification. thatβs the spec revision tea, periodt.
xoxo, Debian β March 23, 2020 π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2002 Packet Design, LLC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms