|
|
1.1 root 1: .TH EXIT 3
2: .CT 2 proc_man
3: .SH NAME
4: exit, onexit \(mi terminate process
5: .SH SYNOPSIS
6: .nf
7: .B void exit(status)
8: .B int status;
9: .PP
10: .B int onexit(fn)
11: .B int (*fn)();
12: .fi
13: .SH DESCRIPTION
14: .I Exit
15: is the conventional way to terminate a process.
16: Before calling
17: .I _exit
18: (see
19: .IR exit (2))
20: with
21: .I status
22: as an argument,
23: it calls in reverse order all the functions
24: recorded by
25: .IR onexit .
26: .PP
27: .I Exit
28: can never return.
29: .PP
30: .I Onexit
31: records
32: .I fn
33: as a function to be called by
34: .IR exit .
35: It returns zero if it failed,
36: nonzero otherwise.
37: Typical uses include cleanup routines for
38: .IR stdio (3)
39: and profiling; see
40: .IR monitor (3).
41: .PP
42: Calling
43: .I onexit
44: twice (or more) with the same function argument causes
45: .I exit
46: to invoke the function twice (or more).
47: .PP
48: The function
49: .I fn
50: should be declared as
51: .EX
52: int fn()
53: .EE
54: .PP
55: The constant
56: .B NONEXIT
57: defined in
58: .B <libc.h>
59: determines how many functions can be recorded.
60: .SH "SEE ALSO"
61: .IR exit (2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.