Update (ui/) keyboard code to use the new version of LaunchProcess.
[chromium-blink-merge.git] / mojo / nacl / monacl_sel_main.cc
blob4fbc5757b6992004b27587f64c6cdfd5ac6a658b
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.
5 #include "mojo/nacl/monacl_sel_main.h"
7 #include <stdio.h>
9 #include "mojo/nacl/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"
15 namespace mojo {
17 void LaunchNaCl(const char* nexe_file, const char* irt_file,
18 int app_argc, char* app_argv[]) {
19 NaClChromeMainInit();
21 // Open the IRT.
22 struct NaClDesc* irt_desc = (struct NaClDesc*) NaClDescIoDescOpen(
23 irt_file, NACL_ABI_O_RDONLY, 0);
24 if (NULL == irt_desc) {
25 perror(irt_file);
26 exit(1);
29 // Open the main executable.
30 struct NaClDesc* nexe_desc = (struct NaClDesc*) NaClDescIoDescOpen(
31 nexe_file, NACL_ABI_O_RDONLY, 0);
32 if (NULL == nexe_desc) {
33 perror(nexe_file);
34 exit(1);
37 struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
38 args->nexe_desc = nexe_desc;
39 args->irt_desc = irt_desc;
41 args->argc = app_argc;
42 args->argv = app_argv;
44 struct NaClApp* nap = NaClAppCreate();
45 InjectMojo(nap);
47 int exit_status = 1;
48 NaClChromeMainStart(nap, args, &exit_status);
49 NaClExit(exit_status);
52 } // namespace mojo