Commit | Line | Data |
---|---|---|
ae59e04c | 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
cd1a8d59 KB |
2 | .\" All rights reserved. |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
043368e6 KB |
5 | .\" Chris Torek and the American National Standards Committee X3, |
6 | .\" on Information Processing Systems. | |
7 | .\" | |
cd1a8d59 KB |
8 | .\" %sccs.include.redist.man% |
9 | .\" | |
043368e6 | 10 | .\" @(#)atexit.3 5.3 (Berkeley) %G% |
cd1a8d59 | 11 | .\" |
ae59e04c CL |
12 | .Dd |
13 | .Dt ATEXIT 3 | |
14 | .Os | |
15 | .Sh NAME | |
16 | .Nm atexit | |
17 | .Nd register a function to be called on exit | |
18 | .Sh SYNOPSIS | |
19 | .Fd #include <stdlib.h> | |
20 | .Ft int | |
21 | .Fn atexit "void (*function)(void)" | |
22 | .Sh DESCRIPTION | |
23 | The | |
24 | .Fn atexit | |
25 | function | |
cd1a8d59 | 26 | registers the given |
ae59e04c | 27 | .Ar function |
cd1a8d59 | 28 | to be called at program exit, whether via |
ae59e04c | 29 | .Xr exit 3 |
cd1a8d59 | 30 | or via return from the program's |
ae59e04c | 31 | .Em main . |
cd1a8d59 KB |
32 | Functions so registered are called in reverse order; |
33 | no arguments are passed. | |
34 | At least 32 functions can always be registered, | |
35 | and more are allowed as long as sufficient memory can be allocated. | |
ae59e04c CL |
36 | .Sh RETURN VALUES |
37 | .Rv -std atexit | |
38 | .Sh ERRORS | |
39 | .Bl -tag -width [ENOMEM] | |
40 | .It Bq Er ENOMEM | |
cd1a8d59 KB |
41 | No memory was available to add the function to the list. |
42 | The existing list of functions is unmodified. | |
ae59e04c CL |
43 | .El |
44 | .Sh SEE ALSO | |
45 | .Xr exit 3 | |
46 | .Sh STANDARDS | |
47 | The | |
48 | .Fn atexit | |
49 | function | |
50 | conforms to | |
51 | .St -ansiC . |