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

Unified Diff: native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc

Issue 349703003: [NaCl SDK] Add some more logging to nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux host build Created 6 years, 6 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
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
index 9b50c90f8055a82ab58b8a8740cc5fa5043b2987..efe805525cc5669a58f3b87d43a529e07a264a60 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
@@ -189,16 +189,21 @@ Error ConsoleNode::Write(const HandleAttr& attr,
int* out_bytes) {
*out_bytes = 0;
- ConsoleInterface* con_intr = filesystem_->ppapi()->GetConsoleInterface();
- VarInterface* var_intr = filesystem_->ppapi()->GetVarInterface();
+ ConsoleInterface* con_iface = filesystem_->ppapi()->GetConsoleInterface();
+ VarInterface* var_iface = filesystem_->ppapi()->GetVarInterface();
- if (!(var_intr && con_intr))
+ if (!(var_iface && con_iface)) {
+ LOG_ERROR("Got NULL interface(s): %s%s",
+ con_iface ? "" : "Console ",
+ var_iface ? "" : "Var");
return ENOSYS;
+ }
const char* var_data = static_cast<const char*>(buf);
uint32_t len = static_cast<uint32_t>(count);
- struct PP_Var val = var_intr->VarFromUtf8(var_data, len);
- con_intr->Log(filesystem_->ppapi()->GetInstance(), level_, val);
+ struct PP_Var val = var_iface->VarFromUtf8(var_data, len);
+ con_iface->Log(filesystem_->ppapi()->GetInstance(), level_, val);
+ var_iface->Release(val);
*out_bytes = count;
return 0;
@@ -241,8 +246,10 @@ Error UrandomNode::Read(const HandleAttr& attr,
*out_bytes = 0;
#if defined(__native_client__)
- if (!interface_ok_)
+ if (!interface_ok_) {
+ LOG_ERROR("NACL_IRT_RANDOM_v0_1 interface not avaiable.");
return EBADF;
+ }
size_t nread;
int error = (*random_interface_.get_random_bytes)(buf, count, &nread);
@@ -295,8 +302,10 @@ Error DevFs::Access(const Path& path, int a_mode) {
return error;
// Don't allow execute access.
- if (a_mode & X_OK)
+ if (a_mode & X_OK) {
+ LOG_TRACE("Executing devfs nodes is not allowed.");
return EACCES;
+ }
return 0;
}
@@ -305,38 +314,47 @@ Error DevFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
out_node->reset(NULL);
int error;
if (path.Part(1) == "fs") {
- if (path.Size() == 3)
+ if (path.Size() == 3) {
error = fs_dir_->FindChild(path.Part(2), out_node);
- else
+ } else {
+ LOG_TRACE("Bad devfs path: %s", path.Join().c_str());
error = ENOENT;
+ }
} else {
error = root_->FindChild(path.Join(), out_node);
}
// Only return EACCES when trying to create a node that does not exist.
- if ((error == ENOENT) && (open_flags & O_CREAT))
+ if ((error == ENOENT) && (open_flags & O_CREAT)) {
+ LOG_TRACE("Cannot create devfs node: %s", path.Join().c_str());
return EACCES;
+ }
return error;
}
Error DevFs::Unlink(const Path& path) {
+ LOG_ERROR("unlink not supported.");
return EPERM;
}
Error DevFs::Mkdir(const Path& path, int permissions) {
+ LOG_ERROR("mkdir not supported.");
return EPERM;
}
Error DevFs::Rmdir(const Path& path) {
+ LOG_ERROR("rmdir not supported.");
return EPERM;
}
Error DevFs::Remove(const Path& path) {
+ LOG_ERROR("remove not supported.");
return EPERM;
}
Error DevFs::Rename(const Path& path, const Path& newpath) {
+ LOG_ERROR("rename not supported.");
return EPERM;
}
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/devfs/jspipe_event_emitter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698