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

Side by Side Diff: net/third_party/nss/ssl/unix_err.c

Issue 1844813002: Uprev NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more GN fix Created 4 years, 8 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 | « net/third_party/nss/ssl/unix_err.h ('k') | net/third_party/nss/ssl/win32err.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* 2 /*
3 * This file essentially replicates NSPR's source for the functions that 3 * This file essentially replicates NSPR's source for the functions that
4 * map system-specific error codes to NSPR error codes. We would use 4 * map system-specific error codes to NSPR error codes. We would use
5 * NSPR's functions, instead of duplicating them, but they're private. 5 * NSPR's functions, instead of duplicating them, but they're private.
6 * As long as SSL's server session cache code must do platform native I/O 6 * As long as SSL's server session cache code must do platform native I/O
7 * to accomplish its job, and NSPR's error mapping functions remain private, 7 * to accomplish its job, and NSPR's error mapping functions remain private,
8 * this code will continue to need to be replicated. 8 * this code will continue to need to be replicated.
9 * 9 *
10 * This Source Code Form is subject to the terms of the Mozilla Public 10 * This Source Code Form is subject to the terms of the Mozilla Public
11 * License, v. 2.0. If a copy of the MPL was not distributed with this 11 * License, v. 2.0. If a copy of the MPL was not distributed with this
12 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 12 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
13 13
14 #if 0 14 #if 0
15 #include "primpl.h" 15 #include "primpl.h"
16 #else 16 #else
17 #define _PR_POLL_AVAILABLE 1 17 #define _PR_POLL_AVAILABLE 1
18 #include "prerror.h" 18 #include "prerror.h"
19 #endif 19 #endif
20 20
21 #if defined (__bsdi__) || defined(NTO) || defined(DARWIN) || defined(BEOS) 21 #if defined(__bsdi__) || defined(NTO) || defined(DARWIN) || defined(BEOS)
22 #undef _PR_POLL_AVAILABLE 22 #undef _PR_POLL_AVAILABLE
23 #endif 23 #endif
24 24
25 #if defined(_PR_POLL_AVAILABLE) 25 #if defined(_PR_POLL_AVAILABLE)
26 #include <poll.h> 26 #include <poll.h>
27 #endif 27 #endif
28 #include <errno.h> 28 #include <errno.h>
29 29
30 /* forward declarations. */ 30 /* forward declarations. */
31 void nss_MD_unix_map_default_error(int err); 31 void nss_MD_unix_map_default_error(int err);
32 32
33 void nss_MD_unix_map_opendir_error(int err) 33 void
34 { 34 nss_MD_unix_map_opendir_error(int err)
35 nss_MD_unix_map_default_error(err); 35 {
36 } 36 nss_MD_unix_map_default_error(err);
37 37 }
38 void nss_MD_unix_map_closedir_error(int err) 38
39 { 39 void
40 PRErrorCode prError; 40 nss_MD_unix_map_closedir_error(int err)
41 switch (err) { 41 {
42 case EINVAL:» prError = PR_BAD_DESCRIPTOR_ERROR; break; 42 PRErrorCode prError;
43 default:» » nss_MD_unix_map_default_error(err); return; 43 switch (err) {
44 } 44 case EINVAL:
45 PR_SetError(prError, err); 45 prError = PR_BAD_DESCRIPTOR_ERROR;
46 } 46 break;
47 47 default:
48 void nss_MD_unix_readdir_error(int err) 48 nss_MD_unix_map_default_error(err);
49 { 49 return;
50 PRErrorCode prError; 50 }
51 51 PR_SetError(prError, err);
52 switch (err) { 52 }
53 case ENOENT:» prError = PR_NO_MORE_FILES_ERROR; break; 53
54 void
55 nss_MD_unix_readdir_error(int err)
56 {
57 PRErrorCode prError;
58
59 switch (err) {
60 case ENOENT:
61 prError = PR_NO_MORE_FILES_ERROR;
62 break;
54 #ifdef EOVERFLOW 63 #ifdef EOVERFLOW
55 case EOVERFLOW:» prError = PR_IO_ERROR; break; 64 case EOVERFLOW:
65 prError = PR_IO_ERROR;
66 break;
56 #endif 67 #endif
57 case EINVAL:» prError = PR_IO_ERROR; break; 68 case EINVAL:
58 case ENXIO:»» prError = PR_IO_ERROR; break; 69 prError = PR_IO_ERROR;
59 default:» » nss_MD_unix_map_default_error(err); return; 70 break;
60 } 71 case ENXIO:
61 PR_SetError(prError, err); 72 prError = PR_IO_ERROR;
62 } 73 break;
63 74 default:
64 void nss_MD_unix_map_unlink_error(int err) 75 nss_MD_unix_map_default_error(err);
65 { 76 return;
66 PRErrorCode prError; 77 }
67 switch (err) { 78 PR_SetError(prError, err);
68 case EPERM:»» prError = PR_IS_DIRECTORY_ERROR; break; 79 }
69 default:» » nss_MD_unix_map_default_error(err); return; 80
70 } 81 void
71 PR_SetError(prError, err); 82 nss_MD_unix_map_unlink_error(int err)
72 } 83 {
73 84 PRErrorCode prError;
74 void nss_MD_unix_map_stat_error(int err) 85 switch (err) {
75 { 86 case EPERM:
76 PRErrorCode prError; 87 prError = PR_IS_DIRECTORY_ERROR;
77 switch (err) { 88 break;
78 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 89 default:
79 default:» » nss_MD_unix_map_default_error(err); return; 90 nss_MD_unix_map_default_error(err);
80 } 91 return;
81 PR_SetError(prError, err); 92 }
82 } 93 PR_SetError(prError, err);
83 94 }
84 void nss_MD_unix_map_fstat_error(int err) 95
85 { 96 void
86 PRErrorCode prError; 97 nss_MD_unix_map_stat_error(int err)
87 switch (err) { 98 {
88 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 99 PRErrorCode prError;
89 default:» » nss_MD_unix_map_default_error(err); return; 100 switch (err) {
90 } 101 case ETIMEDOUT:
91 PR_SetError(prError, err); 102 prError = PR_REMOTE_FILE_ERROR;
92 } 103 break;
93 104 default:
94 void nss_MD_unix_map_rename_error(int err) 105 nss_MD_unix_map_default_error(err);
95 { 106 return;
96 PRErrorCode prError; 107 }
97 switch (err) { 108 PR_SetError(prError, err);
98 case EEXIST:» prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break; 109 }
99 default:» » nss_MD_unix_map_default_error(err); return; 110
100 } 111 void
101 PR_SetError(prError, err); 112 nss_MD_unix_map_fstat_error(int err)
102 } 113 {
103 114 PRErrorCode prError;
104 void nss_MD_unix_map_access_error(int err) 115 switch (err) {
105 { 116 case ETIMEDOUT:
106 PRErrorCode prError; 117 prError = PR_REMOTE_FILE_ERROR;
107 switch (err) { 118 break;
108 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 119 default:
109 default:» » nss_MD_unix_map_default_error(err); return; 120 nss_MD_unix_map_default_error(err);
110 } 121 return;
111 PR_SetError(prError, err); 122 }
112 } 123 PR_SetError(prError, err);
113 124 }
114 void nss_MD_unix_map_mkdir_error(int err) 125
115 { 126 void
116 nss_MD_unix_map_default_error(err); 127 nss_MD_unix_map_rename_error(int err)
117 } 128 {
118 129 PRErrorCode prError;
119 void nss_MD_unix_map_rmdir_error(int err) 130 switch (err) {
120 { 131 case EEXIST:
121 PRErrorCode prError; 132 prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
122 133 break;
123 switch (err) { 134 default:
124 case EEXIST:» prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break; 135 nss_MD_unix_map_default_error(err);
125 case EINVAL:» prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break; 136 return;
126 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 137 }
127 default:» » nss_MD_unix_map_default_error(err); return; 138 PR_SetError(prError, err);
128 } 139 }
129 PR_SetError(prError, err); 140
130 } 141 void
131 142 nss_MD_unix_map_access_error(int err)
132 void nss_MD_unix_map_read_error(int err) 143 {
133 { 144 PRErrorCode prError;
134 PRErrorCode prError; 145 switch (err) {
135 switch (err) { 146 case ETIMEDOUT:
136 case EINVAL:» prError = PR_INVALID_METHOD_ERROR; break; 147 prError = PR_REMOTE_FILE_ERROR;
137 case ENXIO:»» prError = PR_INVALID_ARGUMENT_ERROR; break; 148 break;
138 default:» » nss_MD_unix_map_default_error(err); return; 149 default:
139 } 150 nss_MD_unix_map_default_error(err);
140 PR_SetError(prError, err); 151 return;
141 } 152 }
142 153 PR_SetError(prError, err);
143 void nss_MD_unix_map_write_error(int err) 154 }
144 { 155
145 PRErrorCode prError; 156 void
146 switch (err) { 157 nss_MD_unix_map_mkdir_error(int err)
147 case EINVAL:» prError = PR_INVALID_METHOD_ERROR; break; 158 {
148 case ENXIO:»» prError = PR_INVALID_METHOD_ERROR; break; 159 nss_MD_unix_map_default_error(err);
149 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 160 }
150 default:» » nss_MD_unix_map_default_error(err); return; 161
151 } 162 void
152 PR_SetError(prError, err); 163 nss_MD_unix_map_rmdir_error(int err)
153 } 164 {
154 165 PRErrorCode prError;
155 void nss_MD_unix_map_lseek_error(int err) 166
156 { 167 switch (err) {
157 nss_MD_unix_map_default_error(err); 168 case EEXIST:
158 } 169 prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
159 170 break;
160 void nss_MD_unix_map_fsync_error(int err) 171 case EINVAL:
161 { 172 prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
162 PRErrorCode prError; 173 break;
163 switch (err) { 174 case ETIMEDOUT:
164 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 175 prError = PR_REMOTE_FILE_ERROR;
165 case EINVAL:» prError = PR_INVALID_METHOD_ERROR; break; 176 break;
166 default:» » nss_MD_unix_map_default_error(err); return; 177 default:
167 } 178 nss_MD_unix_map_default_error(err);
168 PR_SetError(prError, err); 179 return;
169 } 180 }
170 181 PR_SetError(prError, err);
171 void nss_MD_unix_map_close_error(int err) 182 }
172 { 183
173 PRErrorCode prError; 184 void
174 switch (err) { 185 nss_MD_unix_map_read_error(int err)
175 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 186 {
176 default:» » nss_MD_unix_map_default_error(err); return; 187 PRErrorCode prError;
177 } 188 switch (err) {
178 PR_SetError(prError, err); 189 case EINVAL:
179 } 190 prError = PR_INVALID_METHOD_ERROR;
180 191 break;
181 void nss_MD_unix_map_socket_error(int err) 192 case ENXIO:
182 { 193 prError = PR_INVALID_ARGUMENT_ERROR;
183 PRErrorCode prError; 194 break;
184 switch (err) { 195 default:
185 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 196 nss_MD_unix_map_default_error(err);
186 default:» » nss_MD_unix_map_default_error(err); return; 197 return;
187 } 198 }
188 PR_SetError(prError, err); 199 PR_SetError(prError, err);
189 } 200 }
190 201
191 void nss_MD_unix_map_socketavailable_error(int err) 202 void
203 nss_MD_unix_map_write_error(int err)
204 {
205 PRErrorCode prError;
206 switch (err) {
207 case EINVAL:
208 prError = PR_INVALID_METHOD_ERROR;
209 break;
210 case ENXIO:
211 prError = PR_INVALID_METHOD_ERROR;
212 break;
213 case ETIMEDOUT:
214 prError = PR_REMOTE_FILE_ERROR;
215 break;
216 default:
217 nss_MD_unix_map_default_error(err);
218 return;
219 }
220 PR_SetError(prError, err);
221 }
222
223 void
224 nss_MD_unix_map_lseek_error(int err)
225 {
226 nss_MD_unix_map_default_error(err);
227 }
228
229 void
230 nss_MD_unix_map_fsync_error(int err)
231 {
232 PRErrorCode prError;
233 switch (err) {
234 case ETIMEDOUT:
235 prError = PR_REMOTE_FILE_ERROR;
236 break;
237 case EINVAL:
238 prError = PR_INVALID_METHOD_ERROR;
239 break;
240 default:
241 nss_MD_unix_map_default_error(err);
242 return;
243 }
244 PR_SetError(prError, err);
245 }
246
247 void
248 nss_MD_unix_map_close_error(int err)
249 {
250 PRErrorCode prError;
251 switch (err) {
252 case ETIMEDOUT:
253 prError = PR_REMOTE_FILE_ERROR;
254 break;
255 default:
256 nss_MD_unix_map_default_error(err);
257 return;
258 }
259 PR_SetError(prError, err);
260 }
261
262 void
263 nss_MD_unix_map_socket_error(int err)
264 {
265 PRErrorCode prError;
266 switch (err) {
267 case ENOMEM:
268 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
269 break;
270 default:
271 nss_MD_unix_map_default_error(err);
272 return;
273 }
274 PR_SetError(prError, err);
275 }
276
277 void
278 nss_MD_unix_map_socketavailable_error(int err)
192 { 279 {
193 PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err); 280 PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
194 } 281 }
195 282
196 void nss_MD_unix_map_recv_error(int err) 283 void
197 { 284 nss_MD_unix_map_recv_error(int err)
198 nss_MD_unix_map_default_error(err); 285 {
199 } 286 nss_MD_unix_map_default_error(err);
200 287 }
201 void nss_MD_unix_map_recvfrom_error(int err) 288
202 { 289 void
203 nss_MD_unix_map_default_error(err); 290 nss_MD_unix_map_recvfrom_error(int err)
204 } 291 {
205 292 nss_MD_unix_map_default_error(err);
206 void nss_MD_unix_map_send_error(int err) 293 }
207 { 294
208 nss_MD_unix_map_default_error(err); 295 void
209 } 296 nss_MD_unix_map_send_error(int err)
210 297 {
211 void nss_MD_unix_map_sendto_error(int err) 298 nss_MD_unix_map_default_error(err);
212 { 299 }
213 nss_MD_unix_map_default_error(err); 300
214 } 301 void
215 302 nss_MD_unix_map_sendto_error(int err)
216 void nss_MD_unix_map_writev_error(int err) 303 {
217 { 304 nss_MD_unix_map_default_error(err);
218 nss_MD_unix_map_default_error(err); 305 }
219 } 306
220 307 void
221 void nss_MD_unix_map_accept_error(int err) 308 nss_MD_unix_map_writev_error(int err)
222 { 309 {
223 PRErrorCode prError; 310 nss_MD_unix_map_default_error(err);
224 switch (err) { 311 }
225 case ENODEV:» prError = PR_NOT_TCP_SOCKET_ERROR; break; 312
226 default:» » nss_MD_unix_map_default_error(err); return; 313 void
227 } 314 nss_MD_unix_map_accept_error(int err)
228 PR_SetError(prError, err); 315 {
229 } 316 PRErrorCode prError;
230 317 switch (err) {
231 void nss_MD_unix_map_connect_error(int err) 318 case ENODEV:
232 { 319 prError = PR_NOT_TCP_SOCKET_ERROR;
233 PRErrorCode prError; 320 break;
234 switch (err) { 321 default:
235 case EACCES:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 322 nss_MD_unix_map_default_error(err);
323 return;
324 }
325 PR_SetError(prError, err);
326 }
327
328 void
329 nss_MD_unix_map_connect_error(int err)
330 {
331 PRErrorCode prError;
332 switch (err) {
333 case EACCES:
334 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
335 break;
236 #if defined(UNIXWARE) || defined(SNI) || defined(NEC) 336 #if defined(UNIXWARE) || defined(SNI) || defined(NEC)
237 /* 337 /*
238 * On some platforms, if we connect to a port on the local host 338 * On some platforms, if we connect to a port on the local host
239 * (the loopback address) that no process is listening on, we get 339 * (the loopback address) that no process is listening on, we get
240 * EIO instead of ECONNREFUSED. 340 * EIO instead of ECONNREFUSED.
241 */ 341 */
242 case EIO:» » prError = PR_CONNECT_REFUSED_ERROR; break; 342 case EIO:
343 prError = PR_CONNECT_REFUSED_ERROR;
344 break;
243 #endif 345 #endif
244 case ELOOP:»» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 346 case ELOOP:
245 case ENOENT:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 347 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
246 case ENXIO:»» prError = PR_IO_ERROR; break; 348 break;
247 default:» » nss_MD_unix_map_default_error(err); return; 349 case ENOENT:
248 } 350 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
249 PR_SetError(prError, err); 351 break;
250 } 352 case ENXIO:
251 353 prError = PR_IO_ERROR;
252 void nss_MD_unix_map_bind_error(int err) 354 break;
253 { 355 default:
254 PRErrorCode prError; 356 nss_MD_unix_map_default_error(err);
255 switch (err) { 357 return;
256 case EINVAL:» prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; break; 358 }
257 /* 359 PR_SetError(prError, err);
258 * UNIX domain sockets are not supported in NSPR 360 }
259 */ 361
260 case EIO:» » prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 362 void
261 case EISDIR:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 363 nss_MD_unix_map_bind_error(int err)
262 case ELOOP:»» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 364 {
263 case ENOENT:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 365 PRErrorCode prError;
264 case ENOTDIR:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 366 switch (err) {
265 case EROFS:»» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 367 case EINVAL:
266 default:» » nss_MD_unix_map_default_error(err); return; 368 prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR;
267 } 369 break;
268 PR_SetError(prError, err); 370 /*
269 } 371 * UNIX domain sockets are not supported in NSPR
270 372 */
271 void nss_MD_unix_map_listen_error(int err) 373 case EIO:
272 { 374 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
273 nss_MD_unix_map_default_error(err); 375 break;
274 } 376 case EISDIR:
275 377 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
276 void nss_MD_unix_map_shutdown_error(int err) 378 break;
277 { 379 case ELOOP:
278 nss_MD_unix_map_default_error(err); 380 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
279 } 381 break;
280 382 case ENOENT:
281 void nss_MD_unix_map_socketpair_error(int err) 383 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
282 { 384 break;
283 PRErrorCode prError; 385 case ENOTDIR:
284 switch (err) { 386 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
285 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 387 break;
286 default:» » nss_MD_unix_map_default_error(err); return; 388 case EROFS:
287 } 389 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
288 PR_SetError(prError, err); 390 break;
289 } 391 default:
290 392 nss_MD_unix_map_default_error(err);
291 void nss_MD_unix_map_getsockname_error(int err) 393 return;
292 { 394 }
293 PRErrorCode prError; 395 PR_SetError(prError, err);
294 switch (err) { 396 }
295 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 397
296 default:» » nss_MD_unix_map_default_error(err); return; 398 void
297 } 399 nss_MD_unix_map_listen_error(int err)
298 PR_SetError(prError, err); 400 {
299 } 401 nss_MD_unix_map_default_error(err);
300 402 }
301 void nss_MD_unix_map_getpeername_error(int err) 403
302 { 404 void
303 PRErrorCode prError; 405 nss_MD_unix_map_shutdown_error(int err)
304 406 {
305 switch (err) { 407 nss_MD_unix_map_default_error(err);
306 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 408 }
307 default:» » nss_MD_unix_map_default_error(err); return; 409
308 } 410 void
309 PR_SetError(prError, err); 411 nss_MD_unix_map_socketpair_error(int err)
310 } 412 {
311 413 PRErrorCode prError;
312 void nss_MD_unix_map_getsockopt_error(int err) 414 switch (err) {
313 { 415 case ENOMEM:
314 PRErrorCode prError; 416 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
315 switch (err) { 417 break;
316 case EINVAL:» prError = PR_BUFFER_OVERFLOW_ERROR; break; 418 default:
317 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 419 nss_MD_unix_map_default_error(err);
318 default:» » nss_MD_unix_map_default_error(err); return; 420 return;
319 } 421 }
320 PR_SetError(prError, err); 422 PR_SetError(prError, err);
321 } 423 }
322 424
323 void nss_MD_unix_map_setsockopt_error(int err) 425 void
324 { 426 nss_MD_unix_map_getsockname_error(int err)
325 PRErrorCode prError; 427 {
326 switch (err) { 428 PRErrorCode prError;
327 case EINVAL:» prError = PR_BUFFER_OVERFLOW_ERROR; break; 429 switch (err) {
328 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 430 case ENOMEM:
329 default:» » nss_MD_unix_map_default_error(err); return; 431 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
330 } 432 break;
331 PR_SetError(prError, err); 433 default:
332 } 434 nss_MD_unix_map_default_error(err);
333 435 return;
334 void nss_MD_unix_map_open_error(int err) 436 }
335 { 437 PR_SetError(prError, err);
336 PRErrorCode prError; 438 }
337 switch (err) { 439
338 case EAGAIN:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 440 void
339 case EBUSY:»» prError = PR_IO_ERROR; break; 441 nss_MD_unix_map_getpeername_error(int err)
340 case ENODEV:» prError = PR_FILE_NOT_FOUND_ERROR; break; 442 {
341 case ENOMEM:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 443 PRErrorCode prError;
342 case ETIMEDOUT:» prError = PR_REMOTE_FILE_ERROR; break; 444
343 default:» » nss_MD_unix_map_default_error(err); return; 445 switch (err) {
344 } 446 case ENOMEM:
345 PR_SetError(prError, err); 447 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
346 } 448 break;
347 449 default:
348 void nss_MD_unix_map_mmap_error(int err) 450 nss_MD_unix_map_default_error(err);
349 { 451 return;
350 PRErrorCode prError; 452 }
351 switch (err) { 453 PR_SetError(prError, err);
352 case EAGAIN:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 454 }
353 case EMFILE:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 455
354 case ENODEV:» prError = PR_OPERATION_NOT_SUPPORTED_ERROR; break; 456 void
355 case ENXIO:»» prError = PR_INVALID_ARGUMENT_ERROR; break; 457 nss_MD_unix_map_getsockopt_error(int err)
356 default:» » nss_MD_unix_map_default_error(err); return; 458 {
357 } 459 PRErrorCode prError;
358 PR_SetError(prError, err); 460 switch (err) {
359 } 461 case EINVAL:
360 462 prError = PR_BUFFER_OVERFLOW_ERROR;
361 void nss_MD_unix_map_gethostname_error(int err) 463 break;
362 { 464 case ENOMEM:
363 nss_MD_unix_map_default_error(err); 465 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
364 } 466 break;
365 467 default:
366 void nss_MD_unix_map_select_error(int err) 468 nss_MD_unix_map_default_error(err);
469 return;
470 }
471 PR_SetError(prError, err);
472 }
473
474 void
475 nss_MD_unix_map_setsockopt_error(int err)
476 {
477 PRErrorCode prError;
478 switch (err) {
479 case EINVAL:
480 prError = PR_BUFFER_OVERFLOW_ERROR;
481 break;
482 case ENOMEM:
483 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
484 break;
485 default:
486 nss_MD_unix_map_default_error(err);
487 return;
488 }
489 PR_SetError(prError, err);
490 }
491
492 void
493 nss_MD_unix_map_open_error(int err)
494 {
495 PRErrorCode prError;
496 switch (err) {
497 case EAGAIN:
498 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
499 break;
500 case EBUSY:
501 prError = PR_IO_ERROR;
502 break;
503 case ENODEV:
504 prError = PR_FILE_NOT_FOUND_ERROR;
505 break;
506 case ENOMEM:
507 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
508 break;
509 case ETIMEDOUT:
510 prError = PR_REMOTE_FILE_ERROR;
511 break;
512 default:
513 nss_MD_unix_map_default_error(err);
514 return;
515 }
516 PR_SetError(prError, err);
517 }
518
519 void
520 nss_MD_unix_map_mmap_error(int err)
521 {
522 PRErrorCode prError;
523 switch (err) {
524 case EAGAIN:
525 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
526 break;
527 case EMFILE:
528 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
529 break;
530 case ENODEV:
531 prError = PR_OPERATION_NOT_SUPPORTED_ERROR;
532 break;
533 case ENXIO:
534 prError = PR_INVALID_ARGUMENT_ERROR;
535 break;
536 default:
537 nss_MD_unix_map_default_error(err);
538 return;
539 }
540 PR_SetError(prError, err);
541 }
542
543 void
544 nss_MD_unix_map_gethostname_error(int err)
545 {
546 nss_MD_unix_map_default_error(err);
547 }
548
549 void
550 nss_MD_unix_map_select_error(int err)
367 { 551 {
368 nss_MD_unix_map_default_error(err); 552 nss_MD_unix_map_default_error(err);
369 } 553 }
370 554
371 #ifdef _PR_POLL_AVAILABLE 555 #ifdef _PR_POLL_AVAILABLE
372 void nss_MD_unix_map_poll_error(int err) 556 void
373 { 557 nss_MD_unix_map_poll_error(int err)
374 PRErrorCode prError; 558 {
375 559 PRErrorCode prError;
376 switch (err) { 560
377 case EAGAIN:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 561 switch (err) {
378 default:» » nss_MD_unix_map_default_error(err); return; 562 case EAGAIN:
379 } 563 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
380 PR_SetError(prError, err); 564 break;
381 } 565 default:
382 566 nss_MD_unix_map_default_error(err);
383 void nss_MD_unix_map_poll_revents_error(int err) 567 return;
568 }
569 PR_SetError(prError, err);
570 }
571
572 void
573 nss_MD_unix_map_poll_revents_error(int err)
384 { 574 {
385 if (err & POLLNVAL) 575 if (err & POLLNVAL)
386 PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF); 576 PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF);
387 else if (err & POLLHUP) 577 else if (err & POLLHUP)
388 PR_SetError(PR_CONNECT_RESET_ERROR, EPIPE); 578 PR_SetError(PR_CONNECT_RESET_ERROR, EPIPE);
389 else if (err & POLLERR) 579 else if (err & POLLERR)
390 PR_SetError(PR_IO_ERROR, EIO); 580 PR_SetError(PR_IO_ERROR, EIO);
391 else 581 else
392 PR_SetError(PR_UNKNOWN_ERROR, err); 582 PR_SetError(PR_UNKNOWN_ERROR, err);
393 } 583 }
394 #endif /* _PR_POLL_AVAILABLE */ 584 #endif /* _PR_POLL_AVAILABLE */
395 585
396 586 void
397 void nss_MD_unix_map_flock_error(int err) 587 nss_MD_unix_map_flock_error(int err)
398 { 588 {
399 PRErrorCode prError; 589 PRErrorCode prError;
400 switch (err) { 590 switch (err) {
401 case EINVAL:» prError = PR_BAD_DESCRIPTOR_ERROR; break; 591 case EINVAL:
402 case EWOULDBLOCK:» prError = PR_FILE_IS_LOCKED_ERROR; break; 592 prError = PR_BAD_DESCRIPTOR_ERROR;
403 default:» » nss_MD_unix_map_default_error(err); return; 593 break;
594 case EWOULDBLOCK:
595 prError = PR_FILE_IS_LOCKED_ERROR;
596 break;
597 default:
598 nss_MD_unix_map_default_error(err);
599 return;
404 } 600 }
405 PR_SetError(prError, err); 601 PR_SetError(prError, err);
406 } 602 }
407 603
408 void nss_MD_unix_map_lockf_error(int err) 604 void
605 nss_MD_unix_map_lockf_error(int err)
409 { 606 {
410 PRErrorCode prError; 607 PRErrorCode prError;
411 switch (err) { 608 switch (err) {
412 case EACCES:» prError = PR_FILE_IS_LOCKED_ERROR; break; 609 case EACCES:
413 case EDEADLK:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 610 prError = PR_FILE_IS_LOCKED_ERROR;
414 default:» » nss_MD_unix_map_default_error(err); return; 611 break;
612 case EDEADLK:
613 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
614 break;
615 default:
616 nss_MD_unix_map_default_error(err);
617 return;
415 } 618 }
416 PR_SetError(prError, err); 619 PR_SetError(prError, err);
417 } 620 }
418 621
419 #ifdef HPUX11 622 #ifdef HPUX11
420 void nss_MD_hpux_map_sendfile_error(int err) 623 void
624 nss_MD_hpux_map_sendfile_error(int err)
421 { 625 {
422 nss_MD_unix_map_default_error(err); 626 nss_MD_unix_map_default_error(err);
423 } 627 }
424 #endif /* HPUX11 */ 628 #endif /* HPUX11 */
425 629
426 630 void
427 void nss_MD_unix_map_default_error(int err) 631 nss_MD_unix_map_default_error(int err)
428 { 632 {
429 PRErrorCode prError; 633 PRErrorCode prError;
430 switch (err ) { 634 switch (err) {
431 case EACCES:» prError = PR_NO_ACCESS_RIGHTS_ERROR; break; 635 case EACCES:
432 case EADDRINUSE:» prError = PR_ADDRESS_IN_USE_ERROR; break; 636 prError = PR_NO_ACCESS_RIGHTS_ERROR;
433 case EADDRNOTAVAIL:»prError = PR_ADDRESS_NOT_AVAILABLE_ERROR; break; 637 break;
434 case EAFNOSUPPORT:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 638 case EADDRINUSE:
435 case EAGAIN:» prError = PR_WOULD_BLOCK_ERROR; break; 639 prError = PR_ADDRESS_IN_USE_ERROR;
640 break;
641 case EADDRNOTAVAIL:
642 prError = PR_ADDRESS_NOT_AVAILABLE_ERROR;
643 break;
644 case EAFNOSUPPORT:
645 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
646 break;
647 case EAGAIN:
648 prError = PR_WOULD_BLOCK_ERROR;
649 break;
436 /* 650 /*
437 * On QNX and Neutrino, EALREADY is defined as EBUSY. 651 * On QNX and Neutrino, EALREADY is defined as EBUSY.
438 */ 652 */
439 #if EALREADY != EBUSY 653 #if EALREADY != EBUSY
440 case EALREADY:» prError = PR_ALREADY_INITIATED_ERROR; break; 654 case EALREADY:
441 #endif 655 prError = PR_ALREADY_INITIATED_ERROR;
442 case EBADF:»» prError = PR_BAD_DESCRIPTOR_ERROR; break; 656 break;
657 #endif
658 case EBADF:
659 prError = PR_BAD_DESCRIPTOR_ERROR;
660 break;
443 #ifdef EBADMSG 661 #ifdef EBADMSG
444 case EBADMSG:» prError = PR_IO_ERROR; break; 662 case EBADMSG:
445 #endif 663 prError = PR_IO_ERROR;
446 case EBUSY:»» prError = PR_FILESYSTEM_MOUNTED_ERROR; break; 664 break;
447 case ECONNREFUSED:» prError = PR_CONNECT_REFUSED_ERROR; break; 665 #endif
448 case ECONNRESET:» prError = PR_CONNECT_RESET_ERROR; break; 666 case EBUSY:
449 case EDEADLK:» prError = PR_DEADLOCK_ERROR; break; 667 prError = PR_FILESYSTEM_MOUNTED_ERROR;
668 break;
669 case ECONNREFUSED:
670 prError = PR_CONNECT_REFUSED_ERROR;
671 break;
672 case ECONNRESET:
673 prError = PR_CONNECT_RESET_ERROR;
674 break;
675 case EDEADLK:
676 prError = PR_DEADLOCK_ERROR;
677 break;
450 #ifdef EDIRCORRUPTED 678 #ifdef EDIRCORRUPTED
451 case EDIRCORRUPTED:»prError = PR_DIRECTORY_CORRUPTED_ERROR; break; 679 case EDIRCORRUPTED:
680 prError = PR_DIRECTORY_CORRUPTED_ERROR;
681 break;
452 #endif 682 #endif
453 #ifdef EDQUOT 683 #ifdef EDQUOT
454 case EDQUOT:» prError = PR_NO_DEVICE_SPACE_ERROR; break; 684 case EDQUOT:
455 #endif 685 prError = PR_NO_DEVICE_SPACE_ERROR;
456 case EEXIST:» prError = PR_FILE_EXISTS_ERROR; break; 686 break;
457 case EFAULT:» prError = PR_ACCESS_FAULT_ERROR; break; 687 #endif
458 case EFBIG:»» prError = PR_FILE_TOO_BIG_ERROR; break; 688 case EEXIST:
459 case EINPROGRESS:» prError = PR_IN_PROGRESS_ERROR; break; 689 prError = PR_FILE_EXISTS_ERROR;
460 case EINTR:»» prError = PR_PENDING_INTERRUPT_ERROR; break; 690 break;
461 case EINVAL:» prError = PR_INVALID_ARGUMENT_ERROR; break; 691 case EFAULT:
462 case EIO:» » prError = PR_IO_ERROR; break; 692 prError = PR_ACCESS_FAULT_ERROR;
463 case EISCONN:» prError = PR_IS_CONNECTED_ERROR; break; 693 break;
464 case EISDIR:» prError = PR_IS_DIRECTORY_ERROR; break; 694 case EFBIG:
465 case ELOOP:»» prError = PR_LOOP_ERROR; break; 695 prError = PR_FILE_TOO_BIG_ERROR;
466 case EMFILE:» prError = PR_PROC_DESC_TABLE_FULL_ERROR; break; 696 break;
467 case EMLINK:» prError = PR_MAX_DIRECTORY_ENTRIES_ERROR; break; 697 case EINPROGRESS:
468 case EMSGSIZE:» prError = PR_INVALID_ARGUMENT_ERROR; break; 698 prError = PR_IN_PROGRESS_ERROR;
699 break;
700 case EINTR:
701 prError = PR_PENDING_INTERRUPT_ERROR;
702 break;
703 case EINVAL:
704 prError = PR_INVALID_ARGUMENT_ERROR;
705 break;
706 case EIO:
707 prError = PR_IO_ERROR;
708 break;
709 case EISCONN:
710 prError = PR_IS_CONNECTED_ERROR;
711 break;
712 case EISDIR:
713 prError = PR_IS_DIRECTORY_ERROR;
714 break;
715 case ELOOP:
716 prError = PR_LOOP_ERROR;
717 break;
718 case EMFILE:
719 prError = PR_PROC_DESC_TABLE_FULL_ERROR;
720 break;
721 case EMLINK:
722 prError = PR_MAX_DIRECTORY_ENTRIES_ERROR;
723 break;
724 case EMSGSIZE:
725 prError = PR_INVALID_ARGUMENT_ERROR;
726 break;
469 #ifdef EMULTIHOP 727 #ifdef EMULTIHOP
470 case EMULTIHOP:» prError = PR_REMOTE_FILE_ERROR; break; 728 case EMULTIHOP:
471 #endif 729 prError = PR_REMOTE_FILE_ERROR;
472 case ENAMETOOLONG:» prError = PR_NAME_TOO_LONG_ERROR; break; 730 break;
473 case ENETUNREACH:» prError = PR_NETWORK_UNREACHABLE_ERROR; break; 731 #endif
474 case ENFILE:» prError = PR_SYS_DESC_TABLE_FULL_ERROR; break; 732 case ENAMETOOLONG:
733 prError = PR_NAME_TOO_LONG_ERROR;
734 break;
735 case ENETUNREACH:
736 prError = PR_NETWORK_UNREACHABLE_ERROR;
737 break;
738 case ENFILE:
739 prError = PR_SYS_DESC_TABLE_FULL_ERROR;
740 break;
475 #if !defined(SCO) 741 #if !defined(SCO)
476 case ENOBUFS:» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 742 case ENOBUFS:
477 #endif 743 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
478 case ENODEV:» prError = PR_FILE_NOT_FOUND_ERROR; break; 744 break;
479 case ENOENT:» prError = PR_FILE_NOT_FOUND_ERROR; break; 745 #endif
480 case ENOLCK:» prError = PR_FILE_IS_LOCKED_ERROR; break; 746 case ENODEV:
481 #ifdef ENOLINK 747 prError = PR_FILE_NOT_FOUND_ERROR;
482 case ENOLINK:» prError = PR_REMOTE_FILE_ERROR; break; 748 break;
483 #endif 749 case ENOENT:
484 case ENOMEM:» prError = PR_OUT_OF_MEMORY_ERROR; break; 750 prError = PR_FILE_NOT_FOUND_ERROR;
485 case ENOPROTOOPT:» prError = PR_INVALID_ARGUMENT_ERROR; break; 751 break;
486 case ENOSPC:» prError = PR_NO_DEVICE_SPACE_ERROR; break; 752 case ENOLCK:
487 #ifdef ENOSR 753 prError = PR_FILE_IS_LOCKED_ERROR;
488 case ENOSR:»» prError = PR_INSUFFICIENT_RESOURCES_ERROR; break; 754 break;
489 #endif 755 #ifdef ENOLINK
490 case ENOTCONN:» prError = PR_NOT_CONNECTED_ERROR; break; 756 case ENOLINK:
491 case ENOTDIR:» prError = PR_NOT_DIRECTORY_ERROR; break; 757 prError = PR_REMOTE_FILE_ERROR;
492 case ENOTSOCK:» prError = PR_NOT_SOCKET_ERROR; break; 758 break;
493 case ENXIO:»» prError = PR_FILE_NOT_FOUND_ERROR; break; 759 #endif
494 case EOPNOTSUPP:» prError = PR_NOT_TCP_SOCKET_ERROR; break; 760 case ENOMEM:
761 prError = PR_OUT_OF_MEMORY_ERROR;
762 break;
763 case ENOPROTOOPT:
764 prError = PR_INVALID_ARGUMENT_ERROR;
765 break;
766 case ENOSPC:
767 prError = PR_NO_DEVICE_SPACE_ERROR;
768 break;
769 #ifdef ENOSR
770 case ENOSR:
771 prError = PR_INSUFFICIENT_RESOURCES_ERROR;
772 break;
773 #endif
774 case ENOTCONN:
775 prError = PR_NOT_CONNECTED_ERROR;
776 break;
777 case ENOTDIR:
778 prError = PR_NOT_DIRECTORY_ERROR;
779 break;
780 case ENOTSOCK:
781 prError = PR_NOT_SOCKET_ERROR;
782 break;
783 case ENXIO:
784 prError = PR_FILE_NOT_FOUND_ERROR;
785 break;
786 case EOPNOTSUPP:
787 prError = PR_NOT_TCP_SOCKET_ERROR;
788 break;
495 #ifdef EOVERFLOW 789 #ifdef EOVERFLOW
496 case EOVERFLOW:» prError = PR_BUFFER_OVERFLOW_ERROR; break; 790 case EOVERFLOW:
497 #endif 791 prError = PR_BUFFER_OVERFLOW_ERROR;
498 case EPERM:»» prError = PR_NO_ACCESS_RIGHTS_ERROR; break; 792 break;
499 case EPIPE:»» prError = PR_CONNECT_RESET_ERROR; break; 793 #endif
794 case EPERM:
795 prError = PR_NO_ACCESS_RIGHTS_ERROR;
796 break;
797 case EPIPE:
798 prError = PR_CONNECT_RESET_ERROR;
799 break;
500 #ifdef EPROTO 800 #ifdef EPROTO
501 case EPROTO:» prError = PR_IO_ERROR; break; 801 case EPROTO:
502 #endif 802 prError = PR_IO_ERROR;
503 case EPROTONOSUPPORT: prError = PR_PROTOCOL_NOT_SUPPORTED_ERROR; break; 803 break;
504 case EPROTOTYPE:» prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break; 804 #endif
505 case ERANGE:» prError = PR_INVALID_METHOD_ERROR; break; 805 case EPROTONOSUPPORT:
506 case EROFS:»» prError = PR_READ_ONLY_FILESYSTEM_ERROR; break; 806 prError = PR_PROTOCOL_NOT_SUPPORTED_ERROR;
507 case ESPIPE:» prError = PR_INVALID_METHOD_ERROR; break; 807 break;
508 case ETIMEDOUT:» prError = PR_IO_TIMEOUT_ERROR; break; 808 case EPROTOTYPE:
809 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
810 break;
811 case ERANGE:
812 prError = PR_INVALID_METHOD_ERROR;
813 break;
814 case EROFS:
815 prError = PR_READ_ONLY_FILESYSTEM_ERROR;
816 break;
817 case ESPIPE:
818 prError = PR_INVALID_METHOD_ERROR;
819 break;
820 case ETIMEDOUT:
821 prError = PR_IO_TIMEOUT_ERROR;
822 break;
509 #if EWOULDBLOCK != EAGAIN 823 #if EWOULDBLOCK != EAGAIN
510 case EWOULDBLOCK:» prError = PR_WOULD_BLOCK_ERROR; break; 824 case EWOULDBLOCK:
511 #endif 825 prError = PR_WOULD_BLOCK_ERROR;
512 case EXDEV:»» prError = PR_NOT_SAME_DEVICE_ERROR; break; 826 break;
513 827 #endif
514 default:» » prError = PR_UNKNOWN_ERROR; break; 828 case EXDEV:
829 prError = PR_NOT_SAME_DEVICE_ERROR;
830 break;
831
832 default:
833 prError = PR_UNKNOWN_ERROR;
834 break;
515 } 835 }
516 PR_SetError(prError, err); 836 PR_SetError(prError, err);
517 } 837 }
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/unix_err.h ('k') | net/third_party/nss/ssl/win32err.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698