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

Side by Side Diff: components/nacl/loader/nonsfi/abi_conversion.cc

Issue 139303003: Implement nacl_irt_clock for non-sfi mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/stat.h> 5 #include <sys/stat.h>
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "native_client/src/trusted/service_runtime/include/sys/stat.h" 11 #include "native_client/src/trusted/service_runtime/include/sys/stat.h"
12 #include "native_client/src/trusted/service_runtime/include/sys/time.h"
12 13
13 namespace nacl { 14 namespace nacl {
14 namespace nonsfi { 15 namespace nonsfi {
15 16
17 void NaClAbiTimeSpecToTimeSpec(const struct nacl_abi_timespec& nacl_timespec,
18 struct timespec* host_timespec) {
19 host_timespec->tv_sec = nacl_timespec.tv_sec;
20 host_timespec->tv_nsec = nacl_timespec.tv_nsec;
21 }
22
23 void TimeSpecToNaClAbiTimeSpec(const struct timespec& host_timespec,
24 struct nacl_abi_timespec* nacl_timespec) {
25 nacl_timespec->tv_sec = host_timespec.tv_sec;
26 nacl_timespec->tv_nsec = host_timespec.tv_nsec;
27 }
28
16 void StatToNaClAbiStat( 29 void StatToNaClAbiStat(
17 const struct stat& host_stat, struct nacl_abi_stat* nacl_stat) { 30 const struct stat& host_stat, struct nacl_abi_stat* nacl_stat) {
18 // Some fields in host_stat, such as st_dev, group/other bits of mode and 31 // Some fields in host_stat, such as st_dev, group/other bits of mode and
19 // (a,m,c)timensec, are ignored to sync with the NaCl's original 32 // (a,m,c)timensec, are ignored to sync with the NaCl's original
20 // implementation. Please see also NaClAbiStatHostDescStatXlateCtor in 33 // implementation. Please see also NaClAbiStatHostDescStatXlateCtor in
21 // native_client/src/trusted/desc/posix/nacl_desc.c. 34 // native_client/src/trusted/desc/posix/nacl_desc.c.
22 std::memset(nacl_stat, 0, sizeof(*nacl_stat)); 35 std::memset(nacl_stat, 0, sizeof(*nacl_stat));
23 nacl_stat->nacl_abi_st_dev = 0; 36 nacl_stat->nacl_abi_st_dev = 0;
24 nacl_stat->nacl_abi_st_ino = host_stat.st_ino; 37 nacl_stat->nacl_abi_st_ino = host_stat.st_ino;
25 nacl_abi_mode_t mode; 38 nacl_abi_mode_t mode;
(...skipping 26 matching lines...) Expand all
52 nacl_stat->nacl_abi_st_size = host_stat.st_size; 65 nacl_stat->nacl_abi_st_size = host_stat.st_size;
53 nacl_stat->nacl_abi_st_blksize = 0; 66 nacl_stat->nacl_abi_st_blksize = 0;
54 nacl_stat->nacl_abi_st_blocks = 0; 67 nacl_stat->nacl_abi_st_blocks = 0;
55 nacl_stat->nacl_abi_st_atime = host_stat.st_atime; 68 nacl_stat->nacl_abi_st_atime = host_stat.st_atime;
56 nacl_stat->nacl_abi_st_mtime = host_stat.st_mtime; 69 nacl_stat->nacl_abi_st_mtime = host_stat.st_mtime;
57 nacl_stat->nacl_abi_st_ctime = host_stat.st_ctime; 70 nacl_stat->nacl_abi_st_ctime = host_stat.st_ctime;
58 } 71 }
59 72
60 } // namespace nonsfi 73 } // namespace nonsfi
61 } // namespace nacl 74 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/loader/nonsfi/abi_conversion.h ('k') | components/nacl/loader/nonsfi/irt_basic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698