Commit | Line | Data |
---|---|---|
cd1a8d59 KB |
1 | .\" Copyright (c) 1990 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Chris Torek. | |
6 | .\" | |
7 | .\" %sccs.include.redist.man% | |
8 | .\" | |
9 | .\" @(#)atexit.3 5.1 (Berkeley) %G% | |
10 | .\" | |
11 | .TH ATEXIT 3 "" | |
12 | .UC 7 | |
13 | .SH NAME | |
14 | atexit \- register a function to be called on exit | |
15 | .SH SYNOPSIS | |
16 | .B #include <stdlib.h> | |
17 | .PP | |
18 | .B "atexit(void (*function)()) | |
19 | .SH DESCRIPTION | |
20 | .B Atexit | |
21 | registers the given | |
22 | .I function | |
23 | to be called at program exit, whether via | |
24 | .IR exit (3) | |
25 | or via return from the program's | |
26 | .BR main . | |
27 | Functions so registered are called in reverse order; | |
28 | no arguments are passed. | |
29 | At least 32 functions can always be registered, | |
30 | and more are allowed as long as sufficient memory can be allocated. | |
31 | .SH RETURN VALUE | |
32 | .B Atexit | |
33 | returns 0 on success, \-1 on error. | |
34 | .SH ERRORS | |
35 | .TP | |
36 | [ENOMEM] | |
37 | No memory was available to add the function to the list. | |
38 | The existing list of functions is unmodified. | |
39 | .SH SEE ALSO | |
40 | exit(3) | |
41 | .SH STANDARDS | |
42 | .B Atexit | |
43 | conforms to ANSI X3.159-1989 (``ANSI C''). |