Chromium Code Reviews| OLD | NEW |
|---|---|
| 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> | 8 #include <stdlib.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 case EHOSTUNREACH: | 43 case EHOSTUNREACH: |
| 44 case EHOSTDOWN: | 44 case EHOSTDOWN: |
| 45 case ENETUNREACH: | 45 case ENETUNREACH: |
| 46 case EAFNOSUPPORT: | 46 case EAFNOSUPPORT: |
| 47 return ERR_ADDRESS_UNREACHABLE; | 47 return ERR_ADDRESS_UNREACHABLE; |
| 48 case EADDRNOTAVAIL: | 48 case EADDRNOTAVAIL: |
| 49 return ERR_ADDRESS_INVALID; | 49 return ERR_ADDRESS_INVALID; |
| 50 case EMSGSIZE: | 50 case EMSGSIZE: |
| 51 return ERR_MSG_TOO_BIG; | 51 return ERR_MSG_TOO_BIG; |
| 52 case ENOTCONN: | 52 case ENOTCONN: |
| 53 return ERR_SOCKET_NOT_CONNECTED; | 53 return ERR_SOCKET_NOT_CONNECTED; |
|
wtc
2013/05/01 01:01:00
Nit: could you add the new error code here?
This
Bei Zhang
2013/05/01 03:49:26
Done.
| |
| 54 case EINVAL: | 54 case EINVAL: |
| 55 return ERR_INVALID_ARGUMENT; | 55 return ERR_INVALID_ARGUMENT; |
| 56 case EADDRINUSE: | 56 case EADDRINUSE: |
| 57 return ERR_ADDRESS_IN_USE; | 57 return ERR_ADDRESS_IN_USE; |
| 58 case E2BIG: // Argument list too long. | 58 case E2BIG: // Argument list too long. |
| 59 return ERR_INVALID_ARGUMENT; | 59 return ERR_INVALID_ARGUMENT; |
| 60 case EBADF: // Bad file descriptor. | 60 case EBADF: // Bad file descriptor. |
| 61 return ERR_INVALID_HANDLE; | 61 return ERR_INVALID_HANDLE; |
| 62 case EBUSY: // Device or resource busy. | 62 case EBUSY: // Device or resource busy. |
| 63 return ERR_INSUFFICIENT_RESOURCES; | 63 return ERR_INSUFFICIENT_RESOURCES; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 case EPERM: // Operation not permitted. | 100 case EPERM: // Operation not permitted. |
| 101 return ERR_ACCESS_DENIED; | 101 return ERR_ACCESS_DENIED; |
| 102 case EROFS: // Read-only file system. | 102 case EROFS: // Read-only file system. |
| 103 return ERR_ACCESS_DENIED; | 103 return ERR_ACCESS_DENIED; |
| 104 case ETXTBSY: // Text file busy. | 104 case ETXTBSY: // Text file busy. |
| 105 return ERR_ACCESS_DENIED; | 105 return ERR_ACCESS_DENIED; |
| 106 case EUSERS: // Too many users. | 106 case EUSERS: // Too many users. |
| 107 return ERR_INSUFFICIENT_RESOURCES; | 107 return ERR_INSUFFICIENT_RESOURCES; |
| 108 case EMFILE: // Too many open files. | 108 case EMFILE: // Too many open files. |
| 109 return ERR_INSUFFICIENT_RESOURCES; | 109 return ERR_INSUFFICIENT_RESOURCES; |
| 110 case EISCONN: | |
| 111 return ERR_SOCKET_IS_CONNECTED; | |
| 110 | 112 |
| 111 case 0: | 113 case 0: |
| 112 return OK; | 114 return OK; |
| 113 default: | 115 default: |
| 114 LOG(WARNING) << "Unknown error " << os_error | 116 LOG(WARNING) << "Unknown error " << os_error |
| 115 << " mapped to net::ERR_FAILED"; | 117 << " mapped to net::ERR_FAILED"; |
| 116 return ERR_FAILED; | 118 return ERR_FAILED; |
| 117 } | 119 } |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace net | 122 } // namespace net |
| OLD | NEW |