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

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

Issue 565343002: [NaCl SDK] nacl_io: Plumb through {,f}utime{,s} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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-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
11 #include "nacl_io/kernel_wrap.h" 11 #include "nacl_io/kernel_wrap.h"
12 12
13 #include <alloca.h> 13 #include <alloca.h>
14 #include <assert.h> 14 #include <assert.h>
15 #include <dirent.h> 15 #include <dirent.h>
16 #include <errno.h> 16 #include <errno.h>
17 #include <irt.h> 17 #include <irt.h>
18 #include <irt_syscalls.h> 18 #include <irt_syscalls.h>
19 #include <nacl_stat.h> 19 #include <nacl_stat.h>
20 #include <string.h> 20 #include <string.h>
21 #include <sys/stat.h> 21 #include <sys/stat.h>
22 #include <sys/time.h> 22 #include <sys/time.h>
23 23
24 #include "nacl_io/kernel_intercept.h" 24 #include "nacl_io/kernel_intercept.h"
25 #include "nacl_io/kernel_wrap_real.h" 25 #include "nacl_io/kernel_wrap_real.h"
26 #include "nacl_io/log.h" 26 #include "nacl_io/log.h"
27 #include "nacl_io/osmman.h" 27 #include "nacl_io/osmman.h"
28 #include "nacl_io/ostime.h"
28 29
29 namespace { 30 namespace {
30 31
31 void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) { 32 void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) {
32 memset(nacl_buf, 0, sizeof(struct nacl_abi_stat)); 33 memset(nacl_buf, 0, sizeof(struct nacl_abi_stat));
33 nacl_buf->nacl_abi_st_dev = buf->st_dev; 34 nacl_buf->nacl_abi_st_dev = buf->st_dev;
34 nacl_buf->nacl_abi_st_ino = buf->st_ino; 35 nacl_buf->nacl_abi_st_ino = buf->st_ino;
35 nacl_buf->nacl_abi_st_mode = buf->st_mode; 36 nacl_buf->nacl_abi_st_mode = buf->st_mode;
36 nacl_buf->nacl_abi_st_nlink = buf->st_nlink; 37 nacl_buf->nacl_abi_st_nlink = buf->st_nlink;
37 nacl_buf->nacl_abi_st_uid = buf->st_uid; 38 nacl_buf->nacl_abi_st_uid = buf->st_uid;
38 nacl_buf->nacl_abi_st_gid = buf->st_gid; 39 nacl_buf->nacl_abi_st_gid = buf->st_gid;
39 nacl_buf->nacl_abi_st_rdev = buf->st_rdev; 40 nacl_buf->nacl_abi_st_rdev = buf->st_rdev;
40 nacl_buf->nacl_abi_st_size = buf->st_size; 41 nacl_buf->nacl_abi_st_size = buf->st_size;
41 nacl_buf->nacl_abi_st_blksize = buf->st_blksize; 42 nacl_buf->nacl_abi_st_blksize = buf->st_blksize;
42 nacl_buf->nacl_abi_st_blocks = buf->st_blocks; 43 nacl_buf->nacl_abi_st_blocks = buf->st_blocks;
43 nacl_buf->nacl_abi_st_atime = buf->st_atime; 44 nacl_buf->nacl_abi_st_atime = buf->st_atime;
45 nacl_buf->nacl_abi_st_atimensec = buf->st_atimensec;
44 nacl_buf->nacl_abi_st_mtime = buf->st_mtime; 46 nacl_buf->nacl_abi_st_mtime = buf->st_mtime;
47 nacl_buf->nacl_abi_st_mtimensec = buf->st_mtimensec;
45 nacl_buf->nacl_abi_st_ctime = buf->st_ctime; 48 nacl_buf->nacl_abi_st_ctime = buf->st_ctime;
49 nacl_buf->nacl_abi_st_ctimensec = buf->st_ctimensec;
46 } 50 }
47 51
48 void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) { 52 void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) {
49 memset(buf, 0, sizeof(struct stat)); 53 memset(buf, 0, sizeof(struct stat));
50 buf->st_dev = nacl_buf->nacl_abi_st_dev; 54 buf->st_dev = nacl_buf->nacl_abi_st_dev;
51 buf->st_ino = nacl_buf->nacl_abi_st_ino; 55 buf->st_ino = nacl_buf->nacl_abi_st_ino;
52 buf->st_mode = nacl_buf->nacl_abi_st_mode; 56 buf->st_mode = nacl_buf->nacl_abi_st_mode;
53 buf->st_nlink = nacl_buf->nacl_abi_st_nlink; 57 buf->st_nlink = nacl_buf->nacl_abi_st_nlink;
54 buf->st_uid = nacl_buf->nacl_abi_st_uid; 58 buf->st_uid = nacl_buf->nacl_abi_st_uid;
55 buf->st_gid = nacl_buf->nacl_abi_st_gid; 59 buf->st_gid = nacl_buf->nacl_abi_st_gid;
56 buf->st_rdev = nacl_buf->nacl_abi_st_rdev; 60 buf->st_rdev = nacl_buf->nacl_abi_st_rdev;
57 buf->st_size = nacl_buf->nacl_abi_st_size; 61 buf->st_size = nacl_buf->nacl_abi_st_size;
58 buf->st_blksize = nacl_buf->nacl_abi_st_blksize; 62 buf->st_blksize = nacl_buf->nacl_abi_st_blksize;
59 buf->st_blocks = nacl_buf->nacl_abi_st_blocks; 63 buf->st_blocks = nacl_buf->nacl_abi_st_blocks;
60 buf->st_atime = nacl_buf->nacl_abi_st_atime; 64 buf->st_atime = nacl_buf->nacl_abi_st_atime;
65 buf->st_atimensec = nacl_buf->nacl_abi_st_atimensec;
61 buf->st_mtime = nacl_buf->nacl_abi_st_mtime; 66 buf->st_mtime = nacl_buf->nacl_abi_st_mtime;
67 buf->st_mtimensec = nacl_buf->nacl_abi_st_mtimensec;
62 buf->st_ctime = nacl_buf->nacl_abi_st_ctime; 68 buf->st_ctime = nacl_buf->nacl_abi_st_ctime;
69 buf->st_ctimensec = nacl_buf->nacl_abi_st_ctimensec;
63 } 70 }
64 71
65 } // namespace 72 } // namespace
66 73
67 // From native_client/src/trusted/service_runtime/include/sys/dirent.h 74 // From native_client/src/trusted/service_runtime/include/sys/dirent.h
68 75
69 #ifndef nacl_abi___ino_t_defined 76 #ifndef nacl_abi___ino_t_defined
70 #define nacl_abi___ino_t_defined 77 #define nacl_abi___ino_t_defined
71 typedef int64_t nacl_abi___ino_t; 78 typedef int64_t nacl_abi___ino_t;
72 typedef nacl_abi___ino_t nacl_abi_ino_t; 79 typedef nacl_abi___ino_t nacl_abi_ino_t;
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 if (s_wrapped) { 657 if (s_wrapped) {
651 LOG_TRACE("kernel_wrap_uninit"); 658 LOG_TRACE("kernel_wrap_uninit");
652 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) 659 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL)
653 s_wrapped = false; 660 s_wrapped = false;
654 } 661 }
655 } 662 }
656 663
657 EXTERN_C_END 664 EXTERN_C_END
658 665
659 #endif // defined(__native_client__) && defined(__GLIBC__) 666 #endif // defined(__native_client__) && defined(__GLIBC__)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698