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 "base/path_service.h" |
| 9 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
| 10 #include "native_client/src/untrusted/irt/irt_dev.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 int IrtOpenResource(const char* filename, int* newfd) { |
| 15 base::FilePath path; |
| 16 if (!PathService::Get(base::DIR_MODULE, &path)) |
| 17 return ENOENT; |
| 18 path = path.Append("pnacl_translation_files"); |
| 19 if (strcmp(filename, "libpnacl_irt_shim.a")) |
| 20 path = path.Append(filename); |
| 21 else |
| 22 path = path.Append("libpnacl_irt_shim_dummy.a"); |
| 23 int rv = open(path.value().c_str(), O_RDONLY); |
| 24 if (rv < 0) |
| 25 return errno; |
| 26 *newfd = rv; |
| 27 return 0; |
| 28 } |
| 29 |
| 30 } // namespace anonymous |
| 31 |
| 32 namespace nacl { |
| 33 |
| 34 const struct nacl_irt_resource_open nacl_irt_resource_open = { |
| 35 IrtOpenResource, |
| 36 }; |
| 37 |
| 38 } // namespace nacl |
OLD | NEW |