OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdlib/] [exit.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * Copyright (c) 1990 Regents of the University of California.
3
 * All rights reserved.
4
 *
5
 * %sccs.include.redist.c%
6
 */
7
 
8
/*
9
FUNCTION
10
<<exit>>---end program execution
11
 
12
INDEX
13
        exit
14
 
15
ANSI_SYNOPSIS
16
        #include <stdlib.h>
17
        void exit(int <[code]>);
18
 
19
TRAD_SYNOPSIS
20
        #include <stdlib.h>
21
        void exit(<[code]>)
22
        int <[code]>;
23
 
24
DESCRIPTION
25
Use <<exit>> to return control from a program to the host operating
26
environment.  Use the argument <[code]> to pass an exit status to the
27
operating environment: two particular values, <<EXIT_SUCCESS>> and
28
<<EXIT_FAILURE>>, are defined in `<<stdlib.h>>' to indicate success or
29
failure in a portable fashion.
30
 
31
<<exit>> does two kinds of cleanup before ending execution of your
32
program.  First, it calls all application-defined cleanup functions
33
you have enrolled with <<atexit>>.  Second, files and streams are
34
cleaned up: any pending output is delivered to the host system, each
35
open file or stream is closed, and files created by <<tmpfile>> are
36
deleted.
37
 
38
RETURNS
39
<<exit>> does not return to its caller.
40
 
41
PORTABILITY
42
ANSI C requires <<exit>>, and specifies that <<EXIT_SUCCESS>> and
43
<<EXIT_FAILURE>> must be defined.
44
 
45
Supporting OS subroutines required: <<_exit>>.
46
*/
47
 
48
#include <stdlib.h>
49
#include <unistd.h>     /* for _exit() declaration */
50
#include <reent.h>
51
#include "atexit.h"
52
 
53
/*
54
 * Exit, flushing stdio buffers if necessary.
55
 */
56
 
57
void
58
_DEFUN (exit, (code),
59
        int code)
60
{
61
  __call_exitprocs (code, NULL);
62
 
63
  if (_GLOBAL_REENT->__cleanup)
64
    (*_GLOBAL_REENT->__cleanup) (_GLOBAL_REENT);
65
  _exit (code);
66
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.