OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "native_client/src/include/portability.h" | 5 #include "native_client/src/include/portability.h" |
6 | 6 |
7 #if NACL_OSX | 7 #if NACL_OSX |
8 #include <crt_externs.h> | 8 #include <crt_externs.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 /* used to be -P */ | 82 /* used to be -P */ |
83 NaClSrpcFileDescriptor = desc; | 83 NaClSrpcFileDescriptor = desc; |
84 /* used to be -X */ | 84 /* used to be -X */ |
85 export_addr_to = desc; | 85 export_addr_to = desc; |
86 | 86 |
87 /* to be passed to NaClMain, eventually... */ | 87 /* to be passed to NaClMain, eventually... */ |
88 av[0] = const_cast<char*>("NaClMain"); | 88 av[0] = const_cast<char*>("NaClMain"); |
89 | 89 |
90 if (!NaClAppCtor(&state)) { | 90 if (!NaClAppCtor(&state)) { |
91 fprintf(stderr, "Error while constructing app state\n"); | 91 fprintf(stderr, "Error while constructing app state\n"); |
92 goto done_file_dtor; | 92 goto done; |
93 } | 93 } |
94 | 94 |
95 state.restrict_to_main_thread = main_thread_only; | 95 state.restrict_to_main_thread = main_thread_only; |
96 | 96 |
97 nap = &state; | 97 nap = &state; |
98 errcode = LOAD_OK; | 98 errcode = LOAD_OK; |
99 | 99 |
100 /* import IMC handle - used to be "-i" */ | 100 /* import IMC handle - used to be "-i" */ |
101 NaClAddImcHandle(nap, handle, desc); | 101 NaClAddImcHandle(nap, handle, desc); |
102 | 102 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 /* | 185 /* |
186 * exit_group or equiv kills any still running threads while module | 186 * exit_group or equiv kills any still running threads while module |
187 * addr space is still valid. otherwise we'd have to kill threads | 187 * addr space is still valid. otherwise we'd have to kill threads |
188 * before we clean up the address space. | 188 * before we clean up the address space. |
189 */ | 189 */ |
190 return ret_code; | 190 return ret_code; |
191 | 191 |
192 done: | 192 done: |
193 fflush(stdout); | 193 fflush(stdout); |
194 | 194 |
195 NaClAppDtor(&state); | |
196 | |
197 done_file_dtor: | |
198 fflush(stdout); | |
199 | |
200 NaClAllModulesFini(); | 195 NaClAllModulesFini(); |
201 | 196 |
202 return ret_code; | 197 return ret_code; |
203 } | 198 } |
204 | 199 |
OLD | NEW |