OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The Native Client Authors. All rights reserved. | 2 * Copyright 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
11 #include "native_client/src/shared/platform/nacl_exit.h" | 11 #include "native_client/src/shared/platform/nacl_exit.h" |
12 #include "native_client/src/trusted/service_runtime/nacl_signal.h" | 12 #include "native_client/src/trusted/service_runtime/nacl_signal.h" |
13 | 13 |
14 | 14 |
15 void NaClAbort(void) { | 15 void NaClAbort(void) { |
16 NaClExit(-SIGABRT); | 16 NaClExit(-SIGABRT); |
17 } | 17 } |
18 | 18 |
19 void NaClExit(int err_code) { | 19 void NaClExit(int err_code) { |
20 #ifdef COVERAGE | 20 #ifdef COVERAGE |
21 /* Give coverage runs a chance to flush coverage data */ | 21 /* Give coverage runs a chance to flush coverage data */ |
22 exit(err_code); | 22 exit(err_code); |
23 #else | 23 #else |
24 /* If the process is scheduled for termination, wait for it.*/ | 24 /* If the process is scheduled for termination, wait for it.*/ |
25 if (TerminateProcess(GetCurrentProcess(), err_code)) { | 25 if (TerminateProcess(GetCurrentProcess(), err_code)) { |
26 printf("Terminate passed, but returned.\n"); | |
27 while(1); | 26 while(1); |
28 } | 27 } |
29 printf("Terminate failed with %d.\n", GetLastError()); | |
30 | 28 |
31 /* Otherwise use the standard C process exit to bybass destructors. */ | 29 /* Otherwise use the standard C process exit to bybass destructors. */ |
32 ExitProcess(err_code); | 30 ExitProcess(err_code); |
33 #endif | 31 #endif |
34 } | 32 } |
35 | 33 |
OLD | NEW |