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

Unified Diff: mojo/nacl/nonsfi/irt_resource_open.cc

Issue 1382713002: Creating a pexe content handler to translate and run pexes. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added Mojom interface to communicate with translation nexes Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698