NAME

at_quick_exit — register a function to to be called from quick_exit()

SYNOPSIS

#include <stdlib.h>

int at_quick_exit(void (*
func)(void));

DESCRIPTION

[CX] [Option Start] 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. [Option End]

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().

RETURN VALUE

Upon successful completion, at_quick_exit() shall return 0; otherwise, it shall return a non-zero value.

ERRORS

No errors are defined.


The following sections are informative.

EXAMPLES

None.

APPLICATION USAGE

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.

RATIONALE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

atexit , exec , exit , quick_exit , sysconf

XBD <stdlib.h>

CHANGE HISTORY

First released in Issue 8. Included for alignment with the ISO/IEC 9899:2018 standard.

End of informative text.