atexit(3)はGoのdeferみたいな感じだけどわね
> The atexit() function registers the given function to be called at program exit, whether via exit(3) or via return from the program's main(). Functions so registered are called in reverse order; no arguments are passed.