Index: mojo/nacl/nonsfi/irt_resource_open.cc |
diff --git a/mojo/nacl/nonsfi/irt_resource_open.cc b/mojo/nacl/nonsfi/irt_resource_open.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9ec4a6741e4c6ddd18f08a6b7a6904687956ec55 |
--- /dev/null |
+++ b/mojo/nacl/nonsfi/irt_resource_open.cc |
@@ -0,0 +1,35 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <fcntl.h> |
+ |
+#include "base/files/file_util.h" |
+#include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h" |
+#include "native_client/src/untrusted/irt/irt_dev.h" |
+ |
+namespace { |
+ |
+int IrtOpenResource(const char *filename, int *newfd) { |
Mark Seaborn
2015/10/27 17:30:20
Nit: use "* " spacing
Sean Klein
2015/10/28 17:02:41
Done.
|
+ std::string path = "native_client/toolchain/linux_x86/pnacl_translator/" |
+ "translator/x86-32-nonsfi/lib/"; |
+ if (strcmp(filename, "libpnacl_irt_shim.a")) |
+ path.append(filename); |
+ else |
+ path.append("libpnacl_irt_shim_dummy.a"); |
+ int rv = open(path.c_str(), O_RDONLY); |
+ if (rv < 0) |
+ return -errno; |
+ *newfd = rv; |
+ return 0; |
+} |
+ |
+} // namespace anonymous |
+ |
+namespace nacl { |
+ |
+const struct nacl_irt_resource_open nacl_irt_resource_open = { |
+ IrtOpenResource, |
+}; |
+ |
+} // namespace nacl |