stsignal(3)
β¨ stsignal(3) β¨
okay so bestie, we're in the ShapeTools Toolkit Library manual, third section, and this whole page is about signal handling π like, catching interrupts so your program doesn't just yeet itself into the void mid-temp-file. it's giving "responsible adult" energy and honestly? we love that for us π«Ά
πΈ NAME πΈ
stCatchSigs, stInterruptAction, stQuitAction, stTermAction, stCleanup, stExit β signal handling π
π¦ SYNOPSIS π¦
#include <config.h>
#include <sttk.h>
void stCatchSigs (void);
Sfunc_t(*stInterruptAction)();
Sfunc_t(*stQuitAction)();
Sfunc_t(*stTermAction)();
void stCleanup (void);
void stExit (int exitCode);
no cap, that's the whole vibe right there β
π DESCRIPTION π
stCatchSigs activates a bunch of interrupt handlers, and here's the tea: they're defined internally in the ShapeTools toolkit library. like, you don't write them, the library already did π
handlers get set up for these signals, periodt:
SIGINTSIGQUITSIGFPESIGBUSSIGSEGVSIGTERM
β οΈ important: all of the interrupt handlers, except the one for SIGINT, cause program termination after having done some cleanup work. so yeah, the program is ending, but at least it's ending tidy β¨
and what is that cleanup, you ask? it's removing all temporary files by calling stRmRegisteredFiles(3). iconic behaviour honestly, cleaning up after yourself is main character energy π§Ήπ
π the customizable ones π
some of the signal handlers are capable of executing functions defined by the application while they're handling the interrupt. it's not automatic though β you activate this mechanism by assigning a function's address to the appropriate variable. iykyk π
here's the complete list, no skips, no cuts:
SIGINTβstInterruptActionSIGQUITβstQuitActionSIGTERMβstTermAction
that's it, that's the whole list bestie π
π the cleanup girlies π
stCleanup calls stRmRegisteredFiles(3) to remove all temporary files, and also calls the AtFS function af_cleanup(3) β which orders AtFS's affairs. like, getting AtFS's whole life together fr fr π¦
stExit does the same as stCleanup, and additionally ends the program execution, returning exitCode. so it's the cleanup + the dramatic exit πͺβ¨
heads up: if you're handingstExitanexitCode, that value is what the program hands back when it dips. keep it in mind πΈ
β SEE ALSO β
signal (3)stRmRegisteredFiles(3)af_cleanup(3)
and that's the whole page bestie!! π this one came out of sttk-1.7, dated Thu Jun 24 17:43:32 1993 β yeah, it's vintage, it's retro, it's lowkey older than everyone in the group chat, and it still ate π β¨ mwah, love u, go catch some signals responsibly π«Άπ
π¦ where this page comes from
- debian bookworm: atfs-dev 1.4pl6-15+b1
- ubuntu jammy: atfs-dev 1.4pl6-15
- ubuntu noble: atfs-dev 1.4pl6-16.1build1
- ubuntu resolute: atfs-dev 1.4pl6-17
- ubuntu stonking: atfs-dev 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms