Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: mojo/nacl/sfi/monacl_shell.cc

Issue 2051163002: Nuke NaCl SFI, part 1. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/nacl/sfi/README.md ('k') | mojo/nacl/sfi/nacl_bindings/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <iostream>
6
7 #include "base/files/file.h"
8 #include "base/files/file_path.h"
9 #include "base/logging.h"
10 #include "mojo/edk/embedder/embedder.h"
11 #include "mojo/edk/embedder/simple_platform_support.h"
12 #include "mojo/nacl/sfi/nacl_bindings/monacl_sel_main.h"
13 #include "native_client/src/public/nacl_desc.h"
14
15 NaClDesc* OpenFile(const char* filename) {
16 base::FilePath path(filename);
17 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
18 if (!file.IsValid()) {
19 perror(filename);
20 exit(1);
21 }
22 return NaClDescCreateWithFilePathMetadata(file.TakePlatformFile(), "");
23 }
24
25 int main(int argc, char* argv[]) {
26 if (argc < 3) {
27 std::cout << "Usage: " << argv[0] << " irt.nexe app.nexe [args for app]" <<
28 std::endl;
29 return 1;
30 }
31
32 const char* irt_file = argv[1];
33 const char* nexe_file = argv[2];
34
35 NaClDesc* irt_desc = OpenFile(irt_file);
36 NaClDesc* nexe_desc = OpenFile(nexe_file);
37
38 mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport());
39
40 int exit_code = mojo::LaunchNaCl(nexe_desc, irt_desc, argc - 2, argv + 2,
41 MOJO_HANDLE_INVALID);
42
43 // Exits the process cleanly, does not return.
44 mojo::NaClExit(exit_code);
45 NOTREACHED();
46 return 1;
47 }
OLDNEW
« no previous file with comments | « mojo/nacl/sfi/README.md ('k') | mojo/nacl/sfi/nacl_bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698