| OLD | NEW |
| 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__) | 9 #if defined(__native_client__) && !defined(__GLIBC__) |
| 10 | 10 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 int _real_rmdir(const char* pathname) { | 308 int _real_rmdir(const char* pathname) { |
| 309 return ENOSYS; | 309 return ENOSYS; |
| 310 } | 310 } |
| 311 | 311 |
| 312 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { | 312 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { |
| 313 CHECK_REAL(write); | 313 CHECK_REAL(write); |
| 314 return REAL(write)(fd, buf, count, nwrote); | 314 return REAL(write)(fd, buf, count, nwrote); |
| 315 } | 315 } |
| 316 | 316 |
| 317 uint64_t usec_since_epoch() { | |
| 318 struct timeval tv; | |
| 319 gettimeofday(&tv, NULL); | |
| 320 return tv.tv_usec + (tv.tv_sec * 1000000); | |
| 321 } | |
| 322 | |
| 323 static bool s_wrapped = false; | 317 static bool s_wrapped = false; |
| 324 | 318 |
| 325 void kernel_wrap_init() { | 319 void kernel_wrap_init() { |
| 326 if (!s_wrapped) { | 320 if (!s_wrapped) { |
| 327 assign_real_pointers(); | 321 assign_real_pointers(); |
| 328 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) | 322 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) |
| 329 s_wrapped = true; | 323 s_wrapped = true; |
| 330 } | 324 } |
| 331 } | 325 } |
| 332 | 326 |
| 333 void kernel_wrap_uninit() { | 327 void kernel_wrap_uninit() { |
| 334 if (s_wrapped) { | 328 if (s_wrapped) { |
| 335 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 329 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
| 336 s_wrapped = false; | 330 s_wrapped = false; |
| 337 } | 331 } |
| 338 } | 332 } |
| 339 | 333 |
| 340 EXTERN_C_END | 334 EXTERN_C_END |
| 341 | 335 |
| 342 #endif // defined(__native_client__) && !defined(__GLIBC__) | 336 #endif // defined(__native_client__) && !defined(__GLIBC__) |
| OLD | NEW |