UCONTEXT(2)
π¦ ucontext(2) β user context π¦
okay so bestie, this is the ucontext page from the System Calls Manual, section 2, and it is literally all about a threadβs user context β¨
π NAME π
ucontext β user context. concise, iconic, periodt π
π SYNOPSIS π
#include <ucontext.h>
_UC_MACHINE_SP(&uc);
_UC_MACHINE_FP(&uc);
_UC_MACHINE_PC(&uc);
_UC_MACHINE_INTRV(&uc);
_UC_MACHINE_SET_PC(&uc);
πΈ DESCRIPTION πΈ
The ucontext_t is a structure type, and it is used to describe the context of a thread of control within the execution of a process. A threadβs context includes its stack, saved registers, and list of blocked signals. no cap, that is the whole vibe π«Ά
The ucontext_t structure includes the following members:
ucontext_t *uc_link
sigset_t uc_sigmask
stack_t uc_stack
mcontext_t uc_mcontext
uc_linkβ points to the context that will be resumed after the function specified when modifying a context usingmakecontext(3)has returned. Ifuc_linkis aNULLpointer, then the context is the main context, and the process will exit with an exit status of0upon return. main character energy, honestly πuc_sigmaskβ this is the set of signals that are blocked when the context is activated. further information can be found insigprocmask(2). signal blocking, but make it fashion πuc_stackβ defines the stack used by the context. further information can be found insigaltstack(2). stack behavior, very demure, very mindful πuc_mcontextβ defines the machine state associated with the context; it may consist of general registers, floating point registers and other machine-specific information. its description is beyond the scope of this manual page; portable applications should not access this structure member. like, do not touch, bestie π
The following auxiliary macros are available to access some of that machine-specific information:
_UC_MACHINE_SP()β read stack pointer,_UC_MACHINE_FP()β read frame pointer (base pointer),_UC_MACHINE_PC()β read program counter,_UC_MACHINE_INTRV()β read integer return value,_UC_MACHINE_SET_PC()β write program counter.
The frame pointer macro does not guarantee to retrieve a reliable value and should not be used in a code unless no other debugging format is easily accessible. a compiler might optimize the frame pointer register in a function, reusing it as a general purpose register storage (-fomit-frame-pointer) or emit function prologues only before parts that need them (-fshrink-wrap). so like, itβs giving βuse at your own risk,β and the risk is real π
π₯ SEE ALSO π₯
_exit(2), getcontext(2), setcontext(2), sigaltstack(2), sigprocmask(2), makecontext(3), swapcontext(3)
π STANDARDS π
The ucontext_t type conforms to X/Open System Interfaces and Headers Issue 5 (βXSH5β) and IEEE Std 1003.1-2001 (βPOSIX.1β). The IEEE Std 1003.1-2008 (βPOSIX.1β) revision removed the ucontext_t from the specification. so yes, it was iconic, then it got removed from the spec β we love a complicated legacy π
this page is from Debian, dated February 25, 2018 β mwah, slay πβ¨
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2001 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms