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

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

Issue 756333005: [NaCl SDK] nacl_io: remove getcwd() implemenation (rely on glibc/newlib versions) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/library.dsc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_intercept.h" 5 #include "nacl_io/kernel_intercept.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void ki_exit(int status) { 144 void ki_exit(int status) {
145 if (ki_is_initialized()) 145 if (ki_is_initialized())
146 s_state.kp->exit(status); 146 s_state.kp->exit(status);
147 147
148 _real_exit(status); 148 _real_exit(status);
149 } 149 }
150 150
151 char* ki_getcwd(char* buf, size_t size) { 151 char* ki_getcwd(char* buf, size_t size) {
152 // gtest uses getcwd in a static initializer and expects it to always 152 ON_NOSYS_RETURN(NULL);
153 // succeed. If we haven't initialized kernel-intercept yet, then try
154 // the IRT's getcwd, and fall back to just returning ".".
155 if (!ki_is_initialized()) {
156 int rtn = _real_getcwd(buf, size);
157 if (rtn != 0) {
158 if (rtn == ENOSYS) {
159 buf[0] = '.';
160 buf[1] = 0;
161 } else {
162 errno = rtn;
163 return NULL;
164 }
165 }
166 return buf;
167 }
168 return s_state.kp->getcwd(buf, size); 153 return s_state.kp->getcwd(buf, size);
169 } 154 }
170 155
171 char* ki_getwd(char* buf) { 156 char* ki_getwd(char* buf) {
172 ON_NOSYS_RETURN(NULL); 157 ON_NOSYS_RETURN(NULL);
173 return s_state.kp->getwd(buf); 158 return s_state.kp->getwd(buf);
174 } 159 }
175 160
176 int ki_dup(int oldfd) { 161 int ki_dup(int oldfd) {
177 ON_NOSYS_RETURN(-1); 162 ON_NOSYS_RETURN(-1);
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 int ki_socket(int domain, int type, int protocol) { 619 int ki_socket(int domain, int type, int protocol) {
635 ON_NOSYS_RETURN(-1); 620 ON_NOSYS_RETURN(-1);
636 return s_state.kp->socket(domain, type, protocol); 621 return s_state.kp->socket(domain, type, protocol);
637 } 622 }
638 623
639 int ki_socketpair(int domain, int type, int protocol, int* sv) { 624 int ki_socketpair(int domain, int type, int protocol, int* sv) {
640 ON_NOSYS_RETURN(-1); 625 ON_NOSYS_RETURN(-1);
641 return s_state.kp->socketpair(domain, type, protocol, sv); 626 return s_state.kp->socketpair(domain, type, protocol, sv);
642 } 627 }
643 #endif // PROVIDES_SOCKET_API 628 #endif // PROVIDES_SOCKET_API
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/library.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698