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

Side by Side Diff: runtime/bin/file_android.cc

Issue 3008943002: [dart:io] Build fixes for Namespaces (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | runtime/bin/namespace_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(HOST_OS_ANDROID) 6 #if defined(HOST_OS_ANDROID)
7 7
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (!StatHelper(namespc, name, &st)) { 490 if (!StatHelper(namespc, name, &st)) {
491 return -1; 491 return -1;
492 } 492 }
493 return st.st_atime; 493 return st.st_atime;
494 } 494 }
495 495
496 bool File::SetLastAccessed(Namespace* namespc, 496 bool File::SetLastAccessed(Namespace* namespc,
497 const char* name, 497 const char* name,
498 int64_t millis) { 498 int64_t millis) {
499 // First get the current times. 499 // First get the current times.
500 struct stat64 st; 500 struct stat st;
501 if (!StatHelper(namespc, name, &st)) { 501 if (!StatHelper(namespc, name, &st)) {
502 return false; 502 return false;
503 } 503 }
504 504
505 // Set the new time: 505 // Set the new time:
506 NamespaceScope ns(namespc, name); 506 NamespaceScope ns(namespc, name);
507 struct timespec times[2]; 507 struct timespec times[2];
508 MillisecondsToTimespec(millis, &times[0]); 508 MillisecondsToTimespec(millis, &times[0]);
509 MillisecondsToTimespec(static_cast<int64_t>(st.st_mtime) * 1000, &times[1]); 509 MillisecondsToTimespec(static_cast<int64_t>(st.st_mtime) * 1000, &times[1]);
510 return utimensat(ns.fd(), ns.path(), times, 0) == 0; 510 return utimensat(ns.fd(), ns.path(), times, 0) == 0;
511 } 511 }
512 512
513 bool File::SetLastModified(Namespace* namespc, 513 bool File::SetLastModified(Namespace* namespc,
514 const char* name, 514 const char* name,
515 int64_t millis) { 515 int64_t millis) {
516 // First get the current times. 516 // First get the current times.
517 struct stat64 st; 517 struct stat st;
518 if (!StatHelper(namespc, name, &st)) { 518 if (!StatHelper(namespc, name, &st)) {
519 return false; 519 return false;
520 } 520 }
521 521
522 // Set the new time: 522 // Set the new time:
523 NamespaceScope ns(namespc, name); 523 NamespaceScope ns(namespc, name);
524 struct timespec times[2]; 524 struct timespec times[2];
525 MillisecondsToTimespec(static_cast<int64_t>(st.st_atime) * 1000, &times[0]); 525 MillisecondsToTimespec(static_cast<int64_t>(st.st_atime) * 1000, &times[0]);
526 MillisecondsToTimespec(millis, &times[1]); 526 MillisecondsToTimespec(millis, &times[1]);
527 return utimensat(ns.fd(), ns.path(), times, 0) == 0; 527 return utimensat(ns.fd(), ns.path(), times, 0) == 0;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return ((file_1_info.st_ino == file_2_info.st_ino) && 667 return ((file_1_info.st_ino == file_2_info.st_ino) &&
668 (file_1_info.st_dev == file_2_info.st_dev)) 668 (file_1_info.st_dev == file_2_info.st_dev))
669 ? File::kIdentical 669 ? File::kIdentical
670 : File::kDifferent; 670 : File::kDifferent;
671 } 671 }
672 672
673 } // namespace bin 673 } // namespace bin
674 } // namespace dart 674 } // namespace dart
675 675
676 #endif // defined(HOST_OS_ANDROID) 676 #endif // defined(HOST_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/namespace_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698