#include #include #include /* tell linker to go find */ void noreturn exit(int code); /* if did not call rt·atexit, then don't pull it in */ static void noop(void){} weakalias(noop, rt·clean); static noreturn void rt·shutdown(int code) { if(rt·context.fini) rt·context.fini(); if(rt·context.exit) rt·context.exit(); /* XXX: better way to encapsulate these calls? */ _syscall1(·ExitGroup, code); for(;;) _syscall1(·Exit, code); } noreturn void rt·exit(int code) { /* ring libc, anyone home? */ exit(code); /* if we are here, we are in charge, shut it down */ rt·clean(); rt·shutdown(code); }