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

Side by Side 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: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698