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

Side by Side Diff: base/files/file_posix.cc

Issue 1001023002: Mapping file busy/exists in POSIX File::OSErrorToFileError(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | no next file » | 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 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 "base/files/file.h" 5 #include "base/files/file.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 464 }
465 465
466 // Static. 466 // Static.
467 File::Error File::OSErrorToFileError(int saved_errno) { 467 File::Error File::OSErrorToFileError(int saved_errno) {
468 switch (saved_errno) { 468 switch (saved_errno) {
469 case EACCES: 469 case EACCES:
470 case EISDIR: 470 case EISDIR:
471 case EROFS: 471 case EROFS:
472 case EPERM: 472 case EPERM:
473 return FILE_ERROR_ACCESS_DENIED; 473 return FILE_ERROR_ACCESS_DENIED;
474 case EBUSY:
rvargas (doing something else) 2015/03/12 22:10:57 My guess is that this is also not defined by NaCl.
cmumford 2015/03/12 22:41:32 Looks like EBUSY *is* supported. Lots of matches i
rvargas (doing something else) 2015/03/12 22:58:07 My impression is that they wanted to provide a str
475 return FILE_ERROR_IN_USE;
474 #if !defined(OS_NACL) // ETXTBSY not defined by NaCl. 476 #if !defined(OS_NACL) // ETXTBSY not defined by NaCl.
475 case ETXTBSY: 477 case ETXTBSY:
rvargas (doing something else) 2015/03/12 22:58:07 nit: Given that this is staying, we should probabl
476 return FILE_ERROR_IN_USE; 478 return FILE_ERROR_IN_USE;
477 #endif 479 #endif
478 case EEXIST: 480 case EEXIST:
479 return FILE_ERROR_EXISTS; 481 return FILE_ERROR_EXISTS;
482 case EIO:
483 return FILE_ERROR_IO;
480 case ENOENT: 484 case ENOENT:
481 return FILE_ERROR_NOT_FOUND; 485 return FILE_ERROR_NOT_FOUND;
482 case EMFILE: 486 case EMFILE:
483 return FILE_ERROR_TOO_MANY_OPENED; 487 return FILE_ERROR_TOO_MANY_OPENED;
484 case ENOMEM: 488 case ENOMEM:
485 return FILE_ERROR_NO_MEMORY; 489 return FILE_ERROR_NO_MEMORY;
486 case ENOSPC: 490 case ENOSPC:
487 return FILE_ERROR_NO_SPACE; 491 return FILE_ERROR_NO_SPACE;
488 case ENOTDIR: 492 case ENOTDIR:
489 return FILE_ERROR_NOT_A_DIRECTORY; 493 return FILE_ERROR_NOT_A_DIRECTORY;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 544 }
541 545
542 void File::SetPlatformFile(PlatformFile file) { 546 void File::SetPlatformFile(PlatformFile file) {
543 CHECK(!file_.is_valid()); 547 CHECK(!file_.is_valid());
544 file_.reset(file); 548 file_.reset(file);
545 if (file_.is_valid()) 549 if (file_.is_valid())
546 ProtectFileDescriptor(GetPlatformFile()); 550 ProtectFileDescriptor(GetPlatformFile());
547 } 551 }
548 552
549 } // namespace base 553 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698