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-glibc build. | 8 // compiled, even on a non-glibc build. |
9 #if defined(__native_client__) && defined(__GLIBC__) | 9 #if defined(__native_client__) && defined(__GLIBC__) |
10 | 10 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 int _real_rmdir(const char* pathname) { | 381 int _real_rmdir(const char* pathname) { |
382 CHECK_REAL(rmdir); | 382 CHECK_REAL(rmdir); |
383 return REAL(rmdir)(pathname); | 383 return REAL(rmdir)(pathname); |
384 } | 384 } |
385 | 385 |
386 int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) { | 386 int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) { |
387 CHECK_REAL(write); | 387 CHECK_REAL(write); |
388 return REAL(write)(fd, buf, count, nwrote); | 388 return REAL(write)(fd, buf, count, nwrote); |
389 } | 389 } |
390 | 390 |
391 uint64_t usec_since_epoch() { | |
392 struct timeval tv; | |
393 gettimeofday(&tv, NULL); | |
394 return tv.tv_usec + (tv.tv_sec * 1000000); | |
395 } | |
396 | |
397 static bool s_wrapped = false; | 391 static bool s_wrapped = false; |
398 void kernel_wrap_init() { | 392 void kernel_wrap_init() { |
399 if (!s_wrapped) { | 393 if (!s_wrapped) { |
400 assign_real_pointers(); | 394 assign_real_pointers(); |
401 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) | 395 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) |
402 s_wrapped = true; | 396 s_wrapped = true; |
403 } | 397 } |
404 } | 398 } |
405 | 399 |
406 void kernel_wrap_uninit() { | 400 void kernel_wrap_uninit() { |
407 if (s_wrapped) { | 401 if (s_wrapped) { |
408 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 402 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
409 s_wrapped = false; | 403 s_wrapped = false; |
410 } | 404 } |
411 } | 405 } |
412 | 406 |
413 EXTERN_C_END | 407 EXTERN_C_END |
414 | 408 |
415 #endif // defined(__native_client__) && defined(__GLIBC__) | 409 #endif // defined(__native_client__) && defined(__GLIBC__) |
OLD | NEW |