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/kernel_proxy.cc

Issue 18644009: [NaCl SDK] Upate atomic ops in nacl_io (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add declartions for newval and oldval Created 7 years, 5 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: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
index dbc5e955ac2dd6a57113b7889b195b22a4d11cea..462e1a3de6f51cae003a346beab7110be71cba50 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
@@ -354,17 +354,13 @@ ssize_t KernelProxy::read(int fd, void* buf, size_t nbytes) {
return -1;
}
- AutoLock lock(&handle->lock_);
int cnt = 0;
- error = handle->node_->Read(handle->offs_, buf, nbytes, &cnt);
+ error = handle->Read(buf, nbytes, &cnt);
if (error) {
errno = error;
return -1;
}
- if (cnt > 0)
- handle->offs_ += cnt;
-
return cnt;
}
@@ -376,17 +372,13 @@ ssize_t KernelProxy::write(int fd, const void* buf, size_t nbytes) {
return -1;
}
- AutoLock lock(&handle->lock_);
int cnt = 0;
- error = handle->node_->Write(handle->offs_, buf, nbytes, &cnt);
+ error = handle->Write(buf, nbytes, &cnt);
if (error) {
errno = error;
return -1;
}
- if (cnt > 0)
- handle->offs_ += cnt;
-
return cnt;
}
@@ -398,7 +390,7 @@ int KernelProxy::fstat(int fd, struct stat* buf) {
return -1;
}
- error = handle->node_->GetStat(buf);
+ error = handle->node()->GetStat(buf);
if (error) {
errno = error;
return -1;
@@ -415,16 +407,11 @@ int KernelProxy::getdents(int fd, void* buf, unsigned int count) {
return -1;
}
- AutoLock lock(&handle->lock_);
int cnt = 0;
- error = handle->node_
- ->GetDents(handle->offs_, static_cast<dirent*>(buf), count, &cnt);
+ error = handle->GetDents(static_cast<dirent*>(buf), count, &cnt);
if (error)
errno = error;
- if (cnt > 0)
- handle->offs_ += cnt;
-
return cnt;
}
@@ -436,7 +423,7 @@ int KernelProxy::ftruncate(int fd, off_t length) {
return -1;
}
- error = handle->node_->FTruncate(length);
+ error = handle->node()->FTruncate(length);
if (error) {
errno = error;
return -1;
@@ -453,7 +440,7 @@ int KernelProxy::fsync(int fd) {
return -1;
}
- error = handle->node_->FSync();
+ error = handle->node()->FSync();
if (error) {
errno = error;
return -1;
@@ -470,7 +457,7 @@ int KernelProxy::isatty(int fd) {
return -1;
}
- error = handle->node_->IsaTTY();
+ error = handle->node()->IsaTTY();
if (error) {
errno = error;
return -1;
@@ -487,7 +474,7 @@ int KernelProxy::ioctl(int d, int request, char* argp) {
return -1;
}
- error = handle->node_->Ioctl(request, argp);
+ error = handle->node()->Ioctl(request, argp);
if (error) {
errno = error;
return -1;
@@ -504,7 +491,6 @@ off_t KernelProxy::lseek(int fd, off_t offset, int whence) {
return -1;
}
- AutoLock lock(&handle->lock_);
off_t new_offset;
error = handle->Seek(offset, whence, &new_offset);
if (error) {
@@ -612,8 +598,7 @@ void* KernelProxy::mmap(void* addr,
}
void* new_addr;
- AutoLock lock(&handle->lock_);
- error = handle->node_->MMap(addr, length, prot, flags, offset, &new_addr);
+ error = handle->node()->MMap(addr, length, prot, flags, offset, &new_addr);
if (error) {
errno = error;
return MAP_FAILED;

Powered by Google App Engine
This is Rietveld 408576698