ON_EXIT(3) — C LIBRARY FUNCTIONS
NAME
on_exit − name termination handler
SYNOPSIS
int on_exit(procp, arg)
void (∗procp)();
caddr_t arg;
DESCRIPTION
On_exit names a routine to be called after a program calls exit(3) or returns normally, and before its process terminates. The routine named is called as
(∗procp)(status, arg);
where status is the argument with which exit was called, or zero if main returns. Typically, arg is the address of an argument vector to (∗procp), but may be an integer value. Several calls may be made to on_exit, specifying several termination handlers. The order in which they are called is the reverse of that in which they were given to on_exit.
SEE ALSO
DIAGNOSTICS
On_exit returns zero normally, or nonzero if the procedure name could not be stored.
BUGS
Currently there is a limit of 20 termination handlers, including any invoked implicitly (for example, by gprof(1) or tcov(1) processing). Calls to on_exit beyond this number will fail.
NOTES
This call is specific to Sun Unix and should not be used if portability is a concern.
Standard I/O exit processing is always done last.
Sun Release 3.0β — Last change: 12 October 1984