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

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

Issue 474433005: [NaCl SDK] Remove syscalls wrappers for chmod and unlink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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 <sys/types.h> // Include something that will define __GLIBC__. 5 #include <sys/types.h> // Include something that will define __GLIBC__.
6 6
7 // The entire file is wrapped in this #if. We do this so this .cc file can be 7 // The entire file is wrapped in this #if. We do this so this .cc file can be
8 // compiled, even on a non-newlib build. 8 // compiled, even on a non-newlib build.
9 #if defined(__native_client__) && !defined(__GLIBC__) && !defined(__BIONIC__) 9 #if defined(__native_client__) && !defined(__GLIBC__) && !defined(__BIONIC__)
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 __libnacl_irt_dev_fdio_init(); 265 __libnacl_irt_dev_fdio_init();
266 EXPAND_SYMBOL_LIST_OPERATION(ASSIGN_REAL_PTR) 266 EXPAND_SYMBOL_LIST_OPERATION(ASSIGN_REAL_PTR)
267 assigned = true; 267 assigned = true;
268 } 268 }
269 } 269 }
270 270
271 #define CHECK_REAL(func) \ 271 #define CHECK_REAL(func) \
272 if (!REAL(func)) \ 272 if (!REAL(func)) \
273 assign_real_pointers(); 273 assign_real_pointers();
274 274
275 #define CHECK_REAL_NOSYS(func) \
276 CHECK_REAL(func) \
277 if (!REAL(func)) \
278 return ENOSYS;
279
275 // "real" functions, i.e. the unwrapped original functions. 280 // "real" functions, i.e. the unwrapped original functions.
276 281
277 int _real_close(int fd) { 282 int _real_close(int fd) {
278 CHECK_REAL(close); 283 CHECK_REAL(close);
279 return REAL(close)(fd); 284 return REAL(close)(fd);
280 } 285 }
281 286
282 void _real_exit(int status) { 287 void _real_exit(int status) {
283 CHECK_REAL(exit); 288 CHECK_REAL(exit);
284 REAL(exit)(status); 289 REAL(exit)(status);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 int _real_rmdir(const char* pathname) { 352 int _real_rmdir(const char* pathname) {
348 CHECK_REAL(rmdir); 353 CHECK_REAL(rmdir);
349 return REAL(rmdir)(pathname); 354 return REAL(rmdir)(pathname);
350 } 355 }
351 356
352 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { 357 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
353 CHECK_REAL(write); 358 CHECK_REAL(write);
354 return REAL(write)(fd, buf, count, nwrote); 359 return REAL(write)(fd, buf, count, nwrote);
355 } 360 }
356 361
362 int _real_getcwd(char* pathname, size_t len) {
binji 2014/08/20 18:13:35 bionic too?
Sam Clegg 2014/08/21 10:19:34 Done.. looks like we don't have a trybot that ev
363 CHECK_REAL_NOSYS(getcwd);
364 return REAL(getcwd)(pathname, len);
365 }
366
357 static bool s_wrapped = false; 367 static bool s_wrapped = false;
358 368
359 void kernel_wrap_init() { 369 void kernel_wrap_init() {
360 if (!s_wrapped) { 370 if (!s_wrapped) {
361 LOG_TRACE("kernel_wrap_init"); 371 LOG_TRACE("kernel_wrap_init");
362 assign_real_pointers(); 372 assign_real_pointers();
363 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) 373 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP)
364 s_wrapped = true; 374 s_wrapped = true;
365 } 375 }
366 } 376 }
367 377
368 void kernel_wrap_uninit() { 378 void kernel_wrap_uninit() {
369 if (s_wrapped) { 379 if (s_wrapped) {
370 LOG_TRACE("kernel_wrap_uninit"); 380 LOG_TRACE("kernel_wrap_uninit");
371 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) 381 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL)
372 s_wrapped = false; 382 s_wrapped = false;
373 } 383 }
374 } 384 }
375 385
376 EXTERN_C_END 386 EXTERN_C_END
377 387
378 #endif // defined(__native_client__) && !defined(__GLIBC__) ... 388 #endif // defined(__native_client__) && !defined(__GLIBC__) ...
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698