Skip to main content

LibX

XSTAR LibX Foundation Library

📄️Init / Exit Calls (initcall)

libx/initcall.h and libx/initcall.c provide XSTAR's init/exit call mechanism. Instead of registering initialization code in a central function, a module simply declares an init function with the xxxinitcall(fn) macro; the linker automatically collects it into a per-level section, and xstarinit() invokes all of them at fixed points during boot. The exit phase is symmetric — xstarexit() calls the functions registered with xxxexitcall(fn) in the reverse order of init.