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

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

Issue 2715463003: Add option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. (Closed)
Patch Set: . Created 3 years, 10 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 | « runtime/bin/file_android.cc ('k') | runtime/bin/file_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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(TARGET_OS_FUCHSIA) 6 #if defined(TARGET_OS_FUCHSIA)
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return NO_RETRY_EXPECTED(read(handle_->fd(), buffer, num_bytes)); 93 return NO_RETRY_EXPECTED(read(handle_->fd(), buffer, num_bytes));
94 } 94 }
95 95
96 96
97 int64_t File::Write(const void* buffer, int64_t num_bytes) { 97 int64_t File::Write(const void* buffer, int64_t num_bytes) {
98 ASSERT(handle_->fd() >= 0); 98 ASSERT(handle_->fd() >= 0);
99 return NO_RETRY_EXPECTED(write(handle_->fd(), buffer, num_bytes)); 99 return NO_RETRY_EXPECTED(write(handle_->fd(), buffer, num_bytes));
100 } 100 }
101 101
102 102
103 bool File::VPrint(const char* format, va_list args) {
104 // Measure.
105 va_list measure_args;
106 va_copy(measure_args, args);
107 intptr_t len = vsnprintf(NULL, 0, format, measure_args);
108 va_end(measure_args);
109
110 char* buffer = reinterpret_cast<char*>(malloc(len + 1));
111
112 // Print.
113 va_list print_args;
114 va_copy(print_args, args);
115 vsnprintf(buffer, len + 1, format, print_args);
116 va_end(print_args);
117
118 bool result = WriteFully(buffer, len);
119 free(buffer);
120 return result;
121 }
122
123
103 int64_t File::Position() { 124 int64_t File::Position() {
104 ASSERT(handle_->fd() >= 0); 125 ASSERT(handle_->fd() >= 0);
105 return NO_RETRY_EXPECTED(lseek(handle_->fd(), 0, SEEK_CUR)); 126 return NO_RETRY_EXPECTED(lseek(handle_->fd(), 0, SEEK_CUR));
106 } 127 }
107 128
108 129
109 bool File::SetPosition(int64_t position) { 130 bool File::SetPosition(int64_t position) {
110 ASSERT(handle_->fd() >= 0); 131 ASSERT(handle_->fd() >= 0);
111 return NO_RETRY_EXPECTED(lseek(handle_->fd(), position, SEEK_SET)) >= 0; 132 return NO_RETRY_EXPECTED(lseek(handle_->fd(), position, SEEK_SET)) >= 0;
112 } 133 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return ((file_1_info.st_ino == file_2_info.st_ino) && 577 return ((file_1_info.st_ino == file_2_info.st_ino) &&
557 (file_1_info.st_dev == file_2_info.st_dev)) 578 (file_1_info.st_dev == file_2_info.st_dev))
558 ? File::kIdentical 579 ? File::kIdentical
559 : File::kDifferent; 580 : File::kDifferent;
560 } 581 }
561 582
562 } // namespace bin 583 } // namespace bin
563 } // namespace dart 584 } // namespace dart
564 585
565 #endif // defined(TARGET_OS_FUCHSIA) 586 #endif // defined(TARGET_OS_FUCHSIA)
OLDNEW
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698