summaryrefslogtreecommitdiff
path: root/static/v10/man3/exit.3
diff options
context:
space:
mode:
Diffstat (limited to 'static/v10/man3/exit.3')
-rw-r--r--static/v10/man3/exit.361
1 files changed, 61 insertions, 0 deletions
diff --git a/static/v10/man3/exit.3 b/static/v10/man3/exit.3
new file mode 100644
index 00000000..af44b48a
--- /dev/null
+++ b/static/v10/man3/exit.3
@@ -0,0 +1,61 @@
+.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)