1ATEXIT(P)                  POSIX Programmer's Manual                 ATEXIT(P)
2
3
4

NAME

6       atexit - register a function to run at process termination
7

SYNOPSIS

9       #include <stdlib.h>
10
11       int atexit(void (*func)(void));
12
13

DESCRIPTION

15       The  atexit()  function shall register the function pointed to by func,
16       to be called without arguments at normal program termination. At normal
17       program  termination, all functions registered by the atexit() function
18       shall be called, in the reverse order  of  their  registration,  except
19       that  a  function  is  called after any previously registered functions
20       that had already been called at the time it was registered. Normal ter‐
21       mination occurs either by a call to exit() or a return from main().
22
23       At least 32 functions can be registered with atexit().
24
25       After  a  successful  call  to any of the exec functions, any functions
26       previously registered by atexit() shall no longer be registered.
27

RETURN VALUE

29       Upon successful completion, atexit()  shall  return  0;  otherwise,  it
30       shall return a non-zero value.
31

ERRORS

33       No errors are defined.
34
35       The following sections are informative.
36

EXAMPLES

38       None.
39

APPLICATION USAGE

41       The  functions  registered  by a call to atexit() must return to ensure
42       that all registered functions are called.
43
44       The  application  should  call  sysconf()  to  obtain  the   value   of
45       {ATEXIT_MAX},  the number of functions that can be registered. There is
46       no way for an application to tell how many functions have already  been
47       registered with atexit().
48

RATIONALE

50       None.
51

FUTURE DIRECTIONS

53       None.
54

SEE ALSO

56       exit()    ,    sysconf()    ,    the   Base   Definitions   volume   of
57       IEEE Std 1003.1-2001, <stdlib.h>
58
60       Portions of this text are reprinted and reproduced in  electronic  form
61       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
62       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
63       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
64       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
65       event of any discrepancy between this version and the original IEEE and
66       The Open Group Standard, the original IEEE and The Open Group  Standard
67       is  the  referee document. The original Standard can be obtained online
68       at http://www.opengroup.org/unix/online.html .
69
70
71
72IEEE/The Open Group                  2003                            ATEXIT(P)
Impressum