OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <fcntl.h> |
| 6 |
| 7 #include "base/files/file_util.h" |
| 8 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
| 9 #include "native_client/src/untrusted/irt/irt_dev.h" |
| 10 |
| 11 namespace { |
| 12 |
| 13 int IrtOpenResource(const char* filename, int* newfd) { |
| 14 std::string path = nacl::MojoGetBasePath(); |
| 15 path.append("pnacl_translation_files/"); |
| 16 if (strcmp(filename, "libpnacl_irt_shim.a")) |
| 17 path.append(filename); |
| 18 else |
| 19 path.append("libpnacl_irt_shim_dummy.a"); |
| 20 int rv = open(path.c_str(), O_RDONLY); |
| 21 if (rv < 0) |
| 22 return -errno; |
| 23 *newfd = rv; |
| 24 return 0; |
| 25 } |
| 26 |
| 27 } // namespace anonymous |
| 28 |
| 29 namespace nacl { |
| 30 |
| 31 const struct nacl_irt_resource_open nacl_irt_resource_open = { |
| 32 IrtOpenResource, |
| 33 }; |
| 34 |
| 35 } // namespace nacl |
OLD | NEW |