File:  [Research Unix] / researchv10dc / man / adm / man3 / exit.3
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

.TH EXIT 3
.CT 2 proc_man
.SH NAME
exit, onexit \(mi terminate process
.SH SYNOPSIS
.nf
.B void exit(status)
.B int status;
.PP
.B int onexit(fn)
.B int (*fn)();
.fi
.SH DESCRIPTION
.I Exit
is the conventional way to terminate a process.
Before calling
.I _exit
(see
.IR exit (2))
with
.I status
as an argument,
it calls in reverse order all the functions
recorded by
.IR onexit .
.PP
.I Exit
can never return.
.PP
.I Onexit
records
.I fn
as a function to be called by
.IR exit .
It returns zero if it failed,
nonzero otherwise.
Typical uses include cleanup routines for
.IR stdio (3)
and profiling; see
.IR monitor (3).
.PP
Calling
.I onexit
twice (or more) with the same function argument causes
.I exit
to invoke the function twice (or more).
.PP
The function
.I fn
should be declared as
.EX
       int fn()
.EE
.PP
The constant
.B NONEXIT
defined in
.B <libc.h>
determines how many functions can be recorded.
.SH "SEE ALSO"
.IR exit (2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.