| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <iostream> | 6 #include <iostream> |
| 7 | 7 |
| 8 #include "mojo/edk/embedder/embedder.h" | 8 #include "mojo/edk/embedder/embedder.h" |
| 9 #include "mojo/edk/embedder/simple_platform_support.h" | 9 #include "mojo/edk/embedder/simple_platform_support.h" |
| 10 #include "mojo/nacl/irt_mojo_nonsfi.h" | 10 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
| 11 #include "native_client/src/public/irt_core.h" | 11 #include "native_client/src/public/irt_core.h" |
| 12 #include "native_client/src/public/nonsfi/elf_loader.h" | 12 #include "native_client/src/public/nonsfi/elf_loader.h" |
| 13 | 13 |
| 14 int main(int argc, char** argv, char** environ) { | 14 int main(int argc, char** argv, char** environ) { |
| 15 nacl_irt_nonsfi_allow_dev_interfaces(); | 15 nacl_irt_nonsfi_allow_dev_interfaces(); |
| 16 if (argc < 2) { | 16 if (argc < 2) { |
| 17 std::cerr << "Usage: " << argv[0] << " <executable> <args...>\n"; | 17 std::cerr << "Usage: " << argv[0] << " <executable> <args...>\n"; |
| 18 return 1; | 18 return 1; |
| 19 } | 19 } |
| 20 const char* nexe_filename = argv[1]; | 20 const char* nexe_filename = argv[1]; |
| 21 int fd = open(nexe_filename, O_RDONLY); | 21 int fd = open(nexe_filename, O_RDONLY); |
| 22 if (fd < 0) { | 22 if (fd < 0) { |
| 23 std::cerr << "Failed to open " << nexe_filename << ": " << | 23 std::cerr << "Failed to open " << nexe_filename << ": " << |
| 24 strerror(errno) << "\n"; | 24 strerror(errno) << "\n"; |
| 25 return 1; | 25 return 1; |
| 26 } | 26 } |
| 27 uintptr_t entry = NaClLoadElfFile(fd); | 27 uintptr_t entry = NaClLoadElfFile(fd); |
| 28 | 28 |
| 29 // TODO(vtl): Use make_unique when C++14 is available. | 29 // TODO(vtl): Use make_unique when C++14 is available. |
| 30 mojo::embedder::Init(std::unique_ptr<mojo::embedder::PlatformSupport>( | 30 mojo::embedder::Init(std::unique_ptr<mojo::embedder::PlatformSupport>( |
| 31 new mojo::embedder::SimplePlatformSupport())); | 31 new mojo::embedder::SimplePlatformSupport())); |
| 32 | 32 |
| 33 return nacl_irt_nonsfi_entry(argc - 1, argv + 1, environ, | 33 return nacl_irt_nonsfi_entry(argc - 1, argv + 1, environ, |
| 34 reinterpret_cast<nacl_entry_func_t>(entry), | 34 reinterpret_cast<nacl_entry_func_t>(entry), |
| 35 nacl::MojoIrtNonsfiQuery); | 35 nacl::MojoIrtNonsfiQuery); |
| 36 } | 36 } |
| OLD | NEW |