at_quick_exit — register a function to to be called from quick_exit()
#include <stdlib.h>
int at_quick_exit(void (*func)(void));
[CX] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1-2024 defers to the ISO C standard.The at_quick_exit() function shall register the function pointed to by func, to be called without arguments should quick_exit() be called. It is unspecified whether a call to the at_quick_exit() function that does not happen before the quick_exit() function is called will succeed.
At least 32 functions can be registered with at_quick_exit().
Upon successful completion, at_quick_exit() shall return 0; otherwise, it shall return a non-zero value.
No errors are defined.
None.
The at_quick_exit() function registrations are distinct from the atexit() registrations, so applications might need to call both registration functions with the same argument.
The functions registered by a call to at_quick_exit() must return to ensure that all registered functions are called.
The application should call sysconf() to obtain the value of {ATEXIT_MAX}, the number of functions that can be registered. There is no way for an application to tell how many functions have already been registered with at_quick_exit().
Since the behavior is undefined if the quick_exit() function is called more than once, portable applications calling at_quick_exit() must ensure that the quick_exit() function is not called when the functions registered by the at_quick_exit() function are called.
If a function registered by the at_quick_exit() function is called and a portable application needs to stop further quick_exit() processing, it must call the _exit() function or the _Exit() function or one of the functions which cause abnormal process termination.
None.
None.
atexit, exec, exit, quick_exit, sysconf
XBD <stdlib.h>
First released in Issue 8. Included for alignment with the ISO/IEC 9899:2018 standard.
return to top of page