| 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..0587f97082ad133cf8dcec8e10d6e8c83a8701b0
|
| --- /dev/null
|
| +++ b/mojo/nacl/nonsfi/irt_resource_open.cc
|
| @@ -0,0 +1,38 @@
|
| +// 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 "base/path_service.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) {
|
| + base::FilePath path;
|
| + if (!PathService::Get(base::DIR_MODULE, &path))
|
| + return ENOENT;
|
| + path = path.Append("pnacl_translation_files");
|
| + if (strcmp(filename, "libpnacl_irt_shim.a"))
|
| + path = path.Append(filename);
|
| + else
|
| + path = path.Append("libpnacl_irt_shim_dummy.a");
|
| + int rv = open(path.value().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
|
|
|