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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       atexit - register a function to run at process termination
13

SYNOPSIS

15       #include <stdlib.h>
16
17       int atexit(void (*func)(void));
18
19

DESCRIPTION

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

RETURN VALUE

35       Upon  successful  completion,  atexit()  shall  return 0; otherwise, it
36       shall return a non-zero value.
37

ERRORS

39       No errors are defined.
40
41       The following sections are informative.
42

EXAMPLES

44       None.
45

APPLICATION USAGE

47       The functions registered by a call to atexit() must  return  to  ensure
48       that all registered functions are called.
49
50       The   application   should  call  sysconf()  to  obtain  the  value  of
51       {ATEXIT_MAX}, the number of functions that can be registered. There  is
52       no  way for an application to tell how many functions have already been
53       registered with atexit().
54

RATIONALE

56       None.
57

FUTURE DIRECTIONS

59       None.
60

SEE ALSO

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