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

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

Issue 115183002: Fix 64-bit linux build after file-copy change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | 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) 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(TARGET_OS_ANDROID) 6 #if defined(TARGET_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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 int new_fd = TEMP_FAILURE_RETRY( 234 int new_fd = TEMP_FAILURE_RETRY(
235 open(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode)); 235 open(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
236 if (new_fd < 0) { 236 if (new_fd < 0) {
237 VOID_TEMP_FAILURE_RETRY(close(old_fd)); 237 VOID_TEMP_FAILURE_RETRY(close(old_fd));
238 return false; 238 return false;
239 } 239 }
240 off64_t offset = 0; 240 off64_t offset = 0;
241 int bytes = 1; 241 int bytes = 1;
242 while (bytes > 0) { 242 while (bytes > 0) {
243 // Loop to ensure we copy everything, and not only up to 2GB. 243 // Loop to ensure we copy everything, and not only up to 2GB.
244 bytes = TEMP_FAILURE_RETRY(sendfile(new_fd, old_fd, &offset, -1)); 244 bytes = TEMP_FAILURE_RETRY(
245 sendfile(new_fd, old_fd, &offset, kMaxUint32));
245 } 246 }
246 if (bytes < 0) { 247 if (bytes < 0) {
247 int e = errno; 248 int e = errno;
248 VOID_TEMP_FAILURE_RETRY(close(old_fd)); 249 VOID_TEMP_FAILURE_RETRY(close(old_fd));
249 VOID_TEMP_FAILURE_RETRY(close(new_fd)); 250 VOID_TEMP_FAILURE_RETRY(close(new_fd));
250 VOID_TEMP_FAILURE_RETRY(unlink(new_path)); 251 VOID_TEMP_FAILURE_RETRY(unlink(new_path));
251 errno = e; 252 errno = e;
252 return false; 253 return false;
253 } 254 }
254 return true; 255 return true;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 return (file_1_info.st_ino == file_2_info.st_ino && 400 return (file_1_info.st_ino == file_2_info.st_ino &&
400 file_1_info.st_dev == file_2_info.st_dev) ? 401 file_1_info.st_dev == file_2_info.st_dev) ?
401 File::kIdentical : 402 File::kIdentical :
402 File::kDifferent; 403 File::kDifferent;
403 } 404 }
404 405
405 } // namespace bin 406 } // namespace bin
406 } // namespace dart 407 } // namespace dart
407 408
408 #endif // defined(TARGET_OS_ANDROID) 409 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698