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

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

Issue 73083005: [NaCl SDK] Enable linux host build for nacl_io and nacl_io_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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__) 9 #if defined(__native_client__) && !defined(__GLIBC__)
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
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__)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698