3 exits, _exits, exitcode, atexit, atexitdont \- terminate process, process cleanup
11 void _exits(char *msg)
16 int exitcode(char *msg)
19 int atexit(void(*)(void))
22 void atexitdont(void(*)(void))
26 is the conventional way to terminate a process.
28 also terminates a process but does not call the registered
36 conventionally includes a brief (maximum length
38 explanation of the reason for
39 exiting, or a null pointer or empty string to indicate normal termination.
40 The string is passed to the parent process, prefixed by the name and process
41 id of the exiting process, when the parent does a
50 calls in reverse order all the functions
57 as a function to be called by
59 It returns zero if it failed,
61 A typical use is to register a cleanup routine for an I/O package.
62 To simplify programs that fork or share memory,
65 .IR atexit -registered
66 functions that were registered by the same
67 process as that calling
72 twice (or more) with the same function argument causes
74 to invoke the function twice (or more).
76 There is a limit to the number of exit functions
77 that will be recorded;
79 returns 0 if that limit has been reached.
82 cancels a previous registration of an exit function.
84 .B \*9/src/lib9/atexit.c
86 .B \*9/src/lib9/_exits.c
91 Because of limitations of Unix, the exit status of a
92 process can only be an 8-bit integer.
96 treat null or empty exit status as exit code 0
99 to translate any other string into an exit code.
100 By default, the library provides an
102 that maps all messages to 1.
103 Applications may find it useful to provide their own
107 Exit codes 97 through 99 are used by the thread library to signal
108 internal synchronization errors between the main program
109 and a proxy process that implements backgrounding.
111 To avoid name conflicts with the underlying system,
115 are preprocessor macros defined as