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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 22842011: [NaCl SDK] Remove invalid assert from nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_proxy.h" 5 #include "nacl_io/kernel_proxy.h"
6 6
7 7
8 #include <assert.h> 8 #include <assert.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Clean up the MountFactories. 79 // Clean up the MountFactories.
80 for (MountFactoryMap_t::iterator i = factories_.begin(); 80 for (MountFactoryMap_t::iterator i = factories_.begin();
81 i != factories_.end(); 81 i != factories_.end();
82 ++i) { 82 ++i) {
83 delete i->second; 83 delete i->second;
84 } 84 }
85 85
86 delete ppapi_; 86 delete ppapi_;
87 } 87 }
88 88
89 void KernelProxy::Init(PepperInterface* ppapi) { 89 Error KernelProxy::Init(PepperInterface* ppapi) {
90 Error rtn = 0;
90 ppapi_ = ppapi; 91 ppapi_ = ppapi;
91 dev_ = 1; 92 dev_ = 1;
92 93
93 factories_["memfs"] = new TypedMountFactory<MountMem>; 94 factories_["memfs"] = new TypedMountFactory<MountMem>;
94 factories_["dev"] = new TypedMountFactory<MountDev>; 95 factories_["dev"] = new TypedMountFactory<MountDev>;
95 factories_["html5fs"] = new TypedMountFactory<MountHtml5Fs>; 96 factories_["html5fs"] = new TypedMountFactory<MountHtml5Fs>;
96 factories_["httpfs"] = new TypedMountFactory<MountHttp>; 97 factories_["httpfs"] = new TypedMountFactory<MountHttp>;
97 factories_["passthroughfs"] = new TypedMountFactory<MountPassthrough>; 98 factories_["passthroughfs"] = new TypedMountFactory<MountPassthrough>;
98 99
99 int result; 100 int result;
100 result = mount("", "/", "passthroughfs", 0, NULL); 101 result = mount("", "/", "passthroughfs", 0, NULL);
101 assert(result == 0); 102 if (result != 0) {
103 assert(false);
104 rtn = errno;
105 }
102 106
103 result = mount("", "/dev", "dev", 0, NULL); 107 result = mount("", "/dev", "dev", 0, NULL);
104 assert(result == 0); 108 if (result != 0) {
109 assert(false);
110 rtn = errno;
111 }
105 112
106 // Open the first three in order to get STDIN, STDOUT, STDERR 113 // Open the first three in order to get STDIN, STDOUT, STDERR
107 open("/dev/stdin", O_RDONLY); 114 int fd;
108 open("/dev/stdout", O_WRONLY); 115 fd = open("/dev/stdin", O_RDONLY);
109 open("/dev/stderr", O_WRONLY); 116 assert(fd == 0);
117 if (fd < 0)
118 rtn = errno;
119
120 fd = open("/dev/stdout", O_WRONLY);
121 assert(fd == 1);
122 if (fd < 0)
123 rtn = errno;
124
125 fd = open("/dev/stderr", O_WRONLY);
126 assert(fd == 2);
127 if (fd < 0)
128 rtn = errno;
110 129
111 #ifdef PROVIDES_SOCKET_API 130 #ifdef PROVIDES_SOCKET_API
112 host_resolver_.Init(ppapi_); 131 host_resolver_.Init(ppapi_);
113 #endif 132 #endif
114 133
115 StringMap_t args; 134 StringMap_t args;
116 socket_mount_.reset(new MountSocket()); 135 socket_mount_.reset(new MountSocket());
117 socket_mount_->Init(0, args, ppapi); 136 result = socket_mount_->Init(0, args, ppapi);
137 if (result != 0) {
138 assert(false);
139 rtn = result;
140 }
141
142 return rtn;
118 } 143 }
119 144
120 int KernelProxy::open_resource(const char* path) { 145 int KernelProxy::open_resource(const char* path) {
121 ScopedMount mnt; 146 ScopedMount mnt;
122 Path rel; 147 Path rel;
123 148
124 Error error = AcquireMountAndRelPath(path, &mnt, &rel); 149 Error error = AcquireMountAndRelPath(path, &mnt, &rel);
125 if (error) { 150 if (error) {
126 errno = error; 151 errno = error;
127 return -1; 152 return -1;
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 errno = ENOTSOCK; 1394 errno = ENOTSOCK;
1370 return -1; 1395 return -1;
1371 } 1396 }
1372 1397
1373 return 0; 1398 return 0;
1374 } 1399 }
1375 1400
1376 #endif // PROVIDES_SOCKET_API 1401 #endif // PROVIDES_SOCKET_API
1377 1402
1378 } // namespace_nacl_io 1403 } // namespace_nacl_io
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_proxy.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698