]> pd.if.org Git - pdclib.old/blobdiff - man3/exit.3
Manual pages: renmae man->man3 to follow existing conventions. Add files _Exit.3...
[pdclib.old] / man3 / exit.3
diff --git a/man3/exit.3 b/man3/exit.3
new file mode 100644 (file)
index 0000000..ac8ae99
--- /dev/null
@@ -0,0 +1,119 @@
+.\" This file is part of the Public Domain C Library (PDCLib).\r
+.\" Permission is granted to use, modify, and / or redistribute at will.\r
+.\"\r
+.Dd\r
+.Dt exit 3\r
+.Os\r
+\r
+.Sh NAME\r
+.Nm exit\r
+.Nd terminates the process\r
+\r
+.Sh SYNOPSIS\r
+.In stdlib.h\r
+.Fn "noreturn void exit" "int status"\r
+.Fn "noreturn void quick_exit" "int status"\r
+.Fn "noreturn void _Exit" "int exitcode"\r
+\r
+.Sh DESCRIPTION\r
+Calling any of these three functions terminates the current process, returning \r
+the exit code passed as a parameter. The interpretation of the exit code is \r
+undefined, except that 0 or\r
+.Dv EXIT_SUCCESS\r
+shall indicate successful completion and\r
+.Dv EXIT_FAILURE\r
+shall indicate a non-successful completion.\r
+\r
+.Pp\r
+.Fn exit\r
+first destroys all objects with C++ thread local storage duration (the C \r
+standard leaves whether or not thread local objects are destroyed or not \r
+undefined). Next, the destructors of all C++ objects of static storage duration \r
+are invoked along with all functions passed to\r
+.Fn atexit \r
+in reverse order of registration (the time of registration for C++ objects of \r
+static storage duration is taken to be the time at which the constructor \r
+completes). It then flushes all open\r
+.Vt FILE\r
+streams with unwritten data and closes them. Finally, files created by\r
+.Fn tmpfile\r
+are removed, before handing control back to the host environment. Note in \r
+particular that functions registered with\r
+.Fn at_quick_exit\r
+are\r
+.Sy not\r
+called.\r
+\r
+.Pp\r
+.Fn quick_exit\r
+invokes any functions registered with\r
+.Fn at_quick_exit\r
+in reverse order of registration, then returns control to the host \r
+environment by calling\r
+.Fn _Exit .\r
+No signal handlers are called, nor are any functions registered with\r
+.Fn atexit .\r
+\r
+.Pp\r
+.Fn _Exit\r
+returns control to the controlling environment without invoking any functions\r
+registered by\r
+.Fn atexit ,\r
+.Fn at_quick_exit ,\r
+any signal handlers, or the destructors of any thread local objects or C++ \r
+objects of static storage duration. Whether or not any open \r
+.Vt FILE\r
+streams with unwritten data are flushed or not is undefined.\r
+\r
+.Pp\r
+The result of aborting a call to \r
+.Fn exit\r
+or\r
+.Fn quick_exit\r
+by use of \r
+.Fn longjmp\r
+is undefined. If any function or destructor invoked by\r
+.Fn exit\r
+or\r
+.Fn quick_exit\r
+should throw, \r
+.Fn std::terminate\r
+is invoked.\r
+\r
+.Pp\r
+Undefined behaviour results if, while a call to\r
+.Fn exit\r
+or\r
+.Fn quick_exit\r
+is in progress, a call to \r
+.Fn exit\r
+or\r
+.Fn quick_exit\r
+is made. \r
+\r
+.Sh IMPLEMENTATION NOTES\r
+PDCLib implements the process of flushing streams in\r
+.Fn _Exit ,\r
+and therefore\r
+.Fn exit\r
+calls it after all\r
+.Fn atexit\r
+handlers have been invoked.\r
+\r
+.Sh SEE ALSO\r
+.Xr abort 3\r
+.Xr atexit 3\r
+.Xr at_quick_exit 3\r
+\r
+.Sh STANDARDS\r
+.Fn exit\r
+is first defined in\r
+.St -isoC-90 ;\r
+.Fn _Exit\r
+was introduced in\r
+.St -isoC-99 .\r
+.Fn quick_exit\r
+was introduced in\r
+.St -isoC-11 \r
+and\r
+ISO/IEC 14882:2011 "C++ 2011" .
\ No newline at end of file