2 * Copyright (c) 1990 Regents of the University of California.
5 * %sccs.include.redist.c%
10 <<exit>>---end program execution
17 void exit(int <[code]>);
20 Use <<exit>> to return control from a program to the host operating
21 environment. Use the argument <[code]> to pass an exit status to the
22 operating environment: two particular values, <<EXIT_SUCCESS>> and
23 <<EXIT_FAILURE>>, are defined in `<<stdlib.h>>' to indicate success or
24 failure in a portable fashion.
26 <<exit>> does two kinds of cleanup before ending execution of your
27 program. First, it calls all application-defined cleanup functions
28 you have enrolled with <<atexit>>. Second, files and streams are
29 cleaned up: any pending output is delivered to the host system, each
30 open file or stream is closed, and files created by <<tmpfile>> are
34 <<exit>> does not return to its caller.
37 ANSI C requires <<exit>>, and specifies that <<EXIT_SUCCESS>> and
38 <<EXIT_FAILURE>> must be defined.
40 Supporting OS subroutines required: <<_exit>>.
44 #include <unistd.h> /* for _exit() declaration */
49 * Exit, flushing stdio buffers if necessary.
56 /* Refer to comments in __atexit.c for more details of lite exit. */
57 void __call_exitprocs (int, void *) __attribute__((weak
));
60 __call_exitprocs (code
, NULL
);
62 if (__stdio_exit_handler
!= NULL
)
63 (*__stdio_exit_handler
) ();