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

Side by Side Diff: net/base/net_errors_posix.cc

Issue 7583049: Record UMA statistics for file_stream operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra logging. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/file_stream_win.cc ('k') | net/base/net_errors_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/net_errors.h" 5 #include "net/base/net_errors.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h>
9 #include <string>
10 #include <unistd.h>
8 11
9 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/stringprintf.h"
10 14
11 namespace net { 15 namespace net {
12 16
13 Error MapSystemError(int os_error) { 17 Error MapSystemError(int os_error) {
18 if (os_error != 0)
19 DVLOG(2) << "Error " << os_error;
20
14 // There are numerous posix error codes, but these are the ones we thus far 21 // There are numerous posix error codes, but these are the ones we thus far
15 // find interesting. 22 // find interesting.
16 switch (os_error) { 23 switch (os_error) {
17 case EAGAIN: 24 case EAGAIN:
18 #if EWOULDBLOCK != EAGAIN 25 #if EWOULDBLOCK != EAGAIN
19 case EWOULDBLOCK: 26 case EWOULDBLOCK:
20 #endif 27 #endif
21 return ERR_IO_PENDING; 28 return ERR_IO_PENDING;
22 case EACCES: 29 case EACCES:
23 return ERR_ACCESS_DENIED; 30 return ERR_ACCESS_DENIED;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 case ENOTSUP: // Operation not supported. 98 case ENOTSUP: // Operation not supported.
92 return ERR_NOT_IMPLEMENTED; 99 return ERR_NOT_IMPLEMENTED;
93 case EPERM: // Operation not permitted. 100 case EPERM: // Operation not permitted.
94 return ERR_ACCESS_DENIED; 101 return ERR_ACCESS_DENIED;
95 case EROFS: // Read-only file system. 102 case EROFS: // Read-only file system.
96 return ERR_ACCESS_DENIED; 103 return ERR_ACCESS_DENIED;
97 case ETXTBSY: // Text file busy. 104 case ETXTBSY: // Text file busy.
98 return ERR_ACCESS_DENIED; 105 return ERR_ACCESS_DENIED;
99 case EUSERS: // Too many users. 106 case EUSERS: // Too many users.
100 return ERR_INSUFFICIENT_RESOURCES; 107 return ERR_INSUFFICIENT_RESOURCES;
108 case EMFILE: // Too many open files.
109 return ERR_INSUFFICIENT_RESOURCES;
101 110
102 case 0: 111 case 0:
103 return OK; 112 return OK;
104 default: 113 default:
105 LOG(WARNING) << "Unknown error " << os_error 114 LOG(WARNING) << "Unknown error " << os_error
106 << " mapped to net::ERR_FAILED"; 115 << " mapped to net::ERR_FAILED";
107 return ERR_FAILED; 116 return ERR_FAILED;
108 } 117 }
109 } 118 }
110 119
111 } // namespace net 120 } // namespace net
OLDNEW
« no previous file with comments | « net/base/file_stream_win.cc ('k') | net/base/net_errors_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698