SETJMP(9)
π SETJMP(9) π
okay so bestie, welcome to the Kernel Developer's Manual, section 9 β this is the setjmp / longjmp page and it is literally about non-local jumps. yes. jumps that are not local. we're going places we shouldn't be able to go and honestly? iconic. β¨
π NAME π
setjmp, longjmp β non-local jumps π¦
β¨ SYNOPSIS β¨
#include <machine/types.h>
#include <sys/systm.h>
int
setjmp(label_t *label);
void
longjmp(label_t *label);
like, that's the whole vibe check right there. two functions. one label pointer each. no cap. π
π DESCRIPTION π
okay so the way this works is: setjmp() saves its calling environment in label. that's it, that's the whole job. and it returns zero on success β so if you see a 0 come back, that's a slay, everything worked. π«Ά
then there's longjmp(), which is the main character of this whole operation. it restores the environment that was saved by the most recent invocation of setjmp(). and then β and this is the part that's giving time-travel β it returns so that kernel execution continues as if the corresponding invocation of the setjmp() had just returned. πβ¨ like you just teleported backwards and nobody around you can even tell. obsessed.
ngl, the lore here is that setjmp() and longjmp() are a machine-independent interface for machine-dependent implementations. so like, the vibe is portable, the guts are not. iykyk. π§
and who's actually using these? these functions are primarily used by ddb(4). that's the one. the debugger bestie. π
π SEE ALSO π
that's the whole page, bestie β go forth and jump non-locally π
signed, sealed, delivered with love from Debian, dated May 23, 2002 β yeah she's vintage, she's a classic, and she still ate ππ
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2002 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