OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/monacl/monacl_sel_main.h" | |
6 | |
7 #include <stdio.h> | |
8 | |
9 #include "mojo/monacl/mojo_syscall.h" | |
10 #include "native_client/src/public/chrome_main.h" | |
11 #include "native_client/src/public/nacl_app.h" | |
12 #include "native_client/src/trusted/desc/nacl_desc_io.h" | |
13 #include "native_client/src/trusted/service_runtime/include/sys/fcntl.h" | |
14 | |
15 void LaunchNaCl(const char* nexe_file, const char* irt_file, | |
16 int app_argc, char* app_argv[]) { | |
17 NaClChromeMainInit(); | |
18 | |
19 // Open the IRT. | |
20 struct NaClDesc* irt_desc = (struct NaClDesc*) NaClDescIoDescOpen( | |
21 irt_file, NACL_ABI_O_RDONLY, 0); | |
22 if (NULL == irt_desc) { | |
23 perror(irt_file); | |
Mark Seaborn
2014/09/09 19:13:12
perror isn't appropriate because NaClDescIoDescOpe
Nick Bray (chromium)
2014/09/09 23:12:33
It will fail if the file does not exist. I cargoc
| |
24 exit(1); | |
25 } | |
26 | |
27 // Open the main executable. | |
28 struct NaClDesc* nexe_desc = (struct NaClDesc*) NaClDescIoDescOpen( | |
29 nexe_file, NACL_ABI_O_RDONLY, 0); | |
30 if (NULL == nexe_desc) { | |
31 perror(nexe_file); | |
32 exit(1); | |
33 } | |
34 | |
35 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate(); | |
36 args->nexe_desc = nexe_desc; | |
37 args->irt_desc = irt_desc; | |
38 | |
39 args->argc = app_argc; | |
40 args->argv = app_argv; | |
41 | |
42 struct NaClApp* nap = NaClAppCreate(); | |
43 InjectMojo(nap); | |
44 | |
45 int exit_status = 1; | |
46 NaClChromeMainStart(nap, args, &exit_status); | |
47 // TODO(ncbray): graceful cleanup? | |
Mark Seaborn
2014/09/09 19:13:12
No TODO needed. NaClExit() is the preferred way t
Nick Bray (chromium)
2014/09/09 23:12:33
"Graceful cleanup" == shutdown NaCl without torchi
| |
48 NaClExit(exit_status); | |
49 } | |
OLD | NEW |