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

Unified Diff: libraries/nacl-mounts/base/Entry.cc

Issue 10832154: Fix dup and dup2 in nacl-mounts (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 4 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 | libraries/nacl-mounts/base/KernelProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libraries/nacl-mounts/base/Entry.cc
===================================================================
--- libraries/nacl-mounts/base/Entry.cc (revision 611)
+++ libraries/nacl-mounts/base/Entry.cc (working copy)
@@ -49,6 +49,8 @@
DECLARE(fdio, read);
DECLARE(fdio, seek);
DECLARE(fdio, write);
+ DECLARE(fdio, dup);
+ DECLARE(fdio, dup2);
DECLARE(filename, open);
DECLARE(filename, stat);
@@ -217,6 +219,19 @@
return (res < 0) ? errno : 0;
}
+ int WRAP(dup)(int fd, int *newfd) {
+ int res = kp->dup(fd);
+ if (res < 0)
+ return errno;
+ *newfd = res;
+ return 0;
+ }
+
+ int WRAP(dup2)(int fd, int newfd) {
+ int res = kp->dup2(fd, newfd);
+ return (res < 0) ? errno : 0;
+ }
+
int WRAP(read)(int fd, void *buf, size_t count, size_t *nread) {
*nread = kp->read(fd, buf, count);
return (*nread < 0) ? errno : 0;
@@ -454,6 +469,8 @@
DO_WRAP(fdio, read);
DO_WRAP(fdio, seek);
DO_WRAP(fdio, write);
+ DO_WRAP(fdio, dup);
+ DO_WRAP(fdio, dup2);
DO_WRAP(filename, open);
DO_WRAP(filename, stat);
DO_WRAP(memory, mmap);
« no previous file with comments | « no previous file | libraries/nacl-mounts/base/KernelProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698