logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

atexit.3p (4124B)


  1. '\" et
  2. .TH ATEXIT "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. atexit
  12. \(em register a function to run at process termination
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdlib.h>
  17. .P
  18. int atexit(void (*\fIfunc\fP)(void));
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. The
  26. \fIatexit\fR()
  27. function shall register the function pointed to by
  28. .IR func ,
  29. to be called without arguments at normal program termination. At normal
  30. program termination, all functions registered by the
  31. \fIatexit\fR()
  32. function shall be called, in the reverse order of their registration,
  33. except that a function is called after any previously registered
  34. functions that had already been called at the time it was registered.
  35. Normal termination occurs either by a call to
  36. \fIexit\fR()
  37. or a return from
  38. \fImain\fR().
  39. .P
  40. At least 32 functions can be registered with
  41. \fIatexit\fR().
  42. .P
  43. After a successful call to any of the
  44. .IR exec
  45. functions, any functions previously registered by
  46. \fIatexit\fR()
  47. shall no longer be registered.
  48. .SH "RETURN VALUE"
  49. Upon successful completion,
  50. \fIatexit\fR()
  51. shall return 0; otherwise, it shall return a non-zero value.
  52. .SH ERRORS
  53. No errors are defined.
  54. .LP
  55. .IR "The following sections are informative."
  56. .SH EXAMPLES
  57. None.
  58. .SH "APPLICATION USAGE"
  59. The functions registered by a call to
  60. \fIatexit\fR()
  61. must return to ensure that all registered functions are called.
  62. .P
  63. The application should call
  64. \fIsysconf\fR()
  65. to obtain the value of
  66. {ATEXIT_MAX},
  67. the number of functions that can be registered. There is no way for an
  68. application to tell how many functions have already been registered
  69. with
  70. \fIatexit\fR().
  71. .P
  72. Since the behavior is undefined if the
  73. \fIexit\fR()
  74. function is called more than once, portable applications calling
  75. \fIatexit\fR()
  76. must ensure that the
  77. \fIexit\fR()
  78. function is not called at normal process termination when all functions
  79. registered by the
  80. \fIatexit\fR()
  81. function are called.
  82. .P
  83. All functions registered by the
  84. \fIatexit\fR()
  85. function are called at normal process termination, which occurs by a
  86. call to the
  87. \fIexit\fR()
  88. function or a return from
  89. \fImain\fR()
  90. or on the last thread termination, when the behavior is as if the
  91. implementation called
  92. \fIexit\fR()
  93. with a zero argument at thread termination time.
  94. .P
  95. If, at normal process termination, a function registered by the
  96. \fIatexit\fR()
  97. function is called and a portable application needs to stop further
  98. \fIexit\fR()
  99. processing, it must call the
  100. \fI_exit\fR()
  101. function or the
  102. \fI_Exit\fR()
  103. function or one of the functions which cause abnormal process
  104. termination.
  105. .SH RATIONALE
  106. None.
  107. .SH "FUTURE DIRECTIONS"
  108. None.
  109. .SH "SEE ALSO"
  110. .IR "\fIexec\fR\^",
  111. .IR "\fIexit\fR\^(\|)",
  112. .IR "\fIsysconf\fR\^(\|)"
  113. .P
  114. The Base Definitions volume of POSIX.1\(hy2017,
  115. .IR "\fB<stdlib.h>\fP"
  116. .\"
  117. .SH COPYRIGHT
  118. Portions of this text are reprinted and reproduced in electronic form
  119. from IEEE Std 1003.1-2017, Standard for Information Technology
  120. -- Portable Operating System Interface (POSIX), The Open Group Base
  121. Specifications Issue 7, 2018 Edition,
  122. Copyright (C) 2018 by the Institute of
  123. Electrical and Electronics Engineers, Inc and The Open Group.
  124. In the event of any discrepancy between this version and the original IEEE and
  125. The Open Group Standard, the original IEEE and The Open Group Standard
  126. is the referee document. The original Standard can be obtained online at
  127. http://www.opengroup.org/unix/online.html .
  128. .PP
  129. Any typographical or formatting errors that appear
  130. in this page are most likely
  131. to have been introduced during the conversion of the source files to
  132. man page format. To report such errors, see
  133. https://www.kernel.org/doc/man-pages/reporting_bugs.html .