Mercurial > ecos
annotate packages/language/c/libc/current/src/stdlib/exit.cxx @ 66:bf00f99aec69 ecos-sw-2000-02-02
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
| author | jlarmour |
|---|---|
| date | Wed, 02 Feb 2000 19:57:02 +0000 |
| parents | c38311975d4f |
| children |
| rev | line source |
|---|---|
| 0 | 1 //========================================================================= |
| 2 // | |
| 3 // exit.cxx | |
| 4 // | |
| 5 // Implementation of the exit() function | |
| 6 // | |
| 7 //========================================================================= | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
12 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
14 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
15 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // |
| 0 | 30 //####COPYRIGHTEND#### |
| 31 //========================================================================= | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): jlarmour | |
| 2 | 35 // Contributors: jlarmour |
| 0 | 36 // Date: 1998-08-31 |
| 37 // Purpose: | |
| 38 // Description: | |
| 39 // Usage: | |
| 40 // | |
| 41 //####DESCRIPTIONEND#### | |
| 42 // | |
| 43 //========================================================================= | |
| 44 | |
| 45 // CONFIGURATION | |
| 46 | |
| 47 #include <pkgconf/libc.h> // Configuration header | |
| 48 | |
| 49 // Include the C library? | |
| 50 #ifdef CYGPKG_LIBC | |
| 51 | |
| 52 // INCLUDES | |
| 53 | |
| 54 #include <cyg/infra/cyg_type.h> // Common type definitions and support | |
| 55 #include <cyg/infra/cyg_trac.h> // Common tracing support | |
| 56 #include <cyg/infra/cyg_ass.h> // Common assertion support | |
| 57 #include <stdio.h> // fflush() | |
| 58 #include <errno.h> // errno | |
| 59 #include <stdlib.h> // Header for all stdlib functions | |
| 60 // (like this one) | |
| 61 #include "clibincl/stdlibsupp.hxx" // Support for stdlib functions | |
| 62 | |
| 63 // SYMBOLS | |
| 64 | |
| 65 externC void | |
| 2 | 66 exit( int ) CYGBLD_ATTRIB_WEAK_ALIAS(__libc_exit) CYGBLD_ATTRIB_NORET; |
| 0 | 67 |
| 68 // FUNCTIONS | |
| 69 | |
| 70 externC void | |
| 71 __libc_exit( int status ) | |
| 72 { | |
| 73 CYG_REPORT_FUNCTION(); // shouldn't return, but CYG_FAIL will catch it | |
| 74 CYG_REPORT_FUNCARG1DV( status ); | |
| 75 | |
| 76 // Strictly the only thing exit() does is invoke the atexit handlers | |
| 77 // and flush stdio buffers. Anything else is for _exit() (aka | |
| 78 // __libc__exit() within the implementation) | |
| 79 | |
| 2 | 80 #ifdef CYGFUN_LIBC_ATEXIT |
| 0 | 81 // we start with the atexit handlers |
| 82 cyg_libc_invoke_atexit_handlers(); | |
| 2 | 83 #endif |
| 0 | 84 |
| 2 | 85 #ifdef CYGSEM_LIBC_EXIT_CALLS_FFLUSH |
| 0 | 86 |
| 87 int rc; | |
| 88 | |
| 89 CYG_TRACE0( true, "Calling fflush( NULL )" ); | |
| 90 rc = fflush( NULL ); | |
| 91 | |
| 92 CYG_TRACE2( rc != 0, "fflush() returned non-zero. It returned %d and " | |
| 93 "errno indicates the error: %s", rc, strerror(errno) ); | |
| 94 #endif | |
| 95 | |
| 96 __libc__exit( status ); | |
| 97 | |
| 98 CYG_FAIL( "__libc_exit() returning!!!" ); | |
| 99 | |
| 100 CYG_REPORT_RETURN(); | |
| 101 } // __libc_exit() | |
| 102 | |
| 103 | |
| 104 #endif // ifdef CYGPKG_LIBC | |
| 105 | |
| 106 // EOF exit.cxx |
