Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / net / third_party / nss / ssl / os2_err.c
bloba69ca91d9cee666cdbd022e6c811a07c301e2081
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
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
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
7 * to accomplish its job, and NSPR's error mapping functions remain private,
8 * this code will continue to need to be replicated.
9 *
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
12 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
14 #include "prerror.h"
15 #include "prlog.h"
16 #include <errno.h>
20 * Based on win32err.c
21 * OS2TODO Stub everything for now to build. HCT
24 /* forward declaration. */
25 void nss_MD_os2_map_default_error(PRInt32 err);
27 void nss_MD_os2_map_opendir_error(PRInt32 err)
29 nss_MD_os2_map_default_error(err);
32 void nss_MD_os2_map_closedir_error(PRInt32 err)
34 nss_MD_os2_map_default_error(err);
37 void nss_MD_os2_map_readdir_error(PRInt32 err)
39 nss_MD_os2_map_default_error(err);
42 void nss_MD_os2_map_delete_error(PRInt32 err)
44 nss_MD_os2_map_default_error(err);
47 /* The error code for stat() is in errno. */
48 void nss_MD_os2_map_stat_error(PRInt32 err)
50 nss_MD_os2_map_default_error(err);
53 void nss_MD_os2_map_fstat_error(PRInt32 err)
55 nss_MD_os2_map_default_error(err);
58 void nss_MD_os2_map_rename_error(PRInt32 err)
60 nss_MD_os2_map_default_error(err);
63 /* The error code for access() is in errno. */
64 void nss_MD_os2_map_access_error(PRInt32 err)
66 nss_MD_os2_map_default_error(err);
69 void nss_MD_os2_map_mkdir_error(PRInt32 err)
71 nss_MD_os2_map_default_error(err);
74 void nss_MD_os2_map_rmdir_error(PRInt32 err)
76 nss_MD_os2_map_default_error(err);
79 void nss_MD_os2_map_read_error(PRInt32 err)
81 nss_MD_os2_map_default_error(err);
84 void nss_MD_os2_map_transmitfile_error(PRInt32 err)
86 nss_MD_os2_map_default_error(err);
89 void nss_MD_os2_map_write_error(PRInt32 err)
91 nss_MD_os2_map_default_error(err);
94 void nss_MD_os2_map_lseek_error(PRInt32 err)
96 nss_MD_os2_map_default_error(err);
99 void nss_MD_os2_map_fsync_error(PRInt32 err)
101 nss_MD_os2_map_default_error(err);
105 * For both CloseHandle() and closesocket().
107 void nss_MD_os2_map_close_error(PRInt32 err)
109 nss_MD_os2_map_default_error(err);
112 void nss_MD_os2_map_socket_error(PRInt32 err)
114 // PR_ASSERT(err != WSANOTINITIALISED);
115 nss_MD_os2_map_default_error(err);
118 void nss_MD_os2_map_recv_error(PRInt32 err)
120 nss_MD_os2_map_default_error(err);
123 void nss_MD_os2_map_recvfrom_error(PRInt32 err)
125 nss_MD_os2_map_default_error(err);
128 void nss_MD_os2_map_send_error(PRInt32 err)
130 PRErrorCode prError;
131 switch (err) {
132 // case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break;
133 default: nss_MD_os2_map_default_error(err); return;
135 PR_SetError(prError, err);
138 void nss_MD_os2_map_sendto_error(PRInt32 err)
140 PRErrorCode prError;
141 switch (err) {
142 // case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break;
143 default: nss_MD_os2_map_default_error(err); return;
145 PR_SetError(prError, err);
148 void nss_MD_os2_map_accept_error(PRInt32 err)
150 PRErrorCode prError;
151 switch (err) {
152 // case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break;
153 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
154 default: nss_MD_os2_map_default_error(err); return;
156 PR_SetError(prError, err);
159 void nss_MD_os2_map_acceptex_error(PRInt32 err)
161 nss_MD_os2_map_default_error(err);
164 void nss_MD_os2_map_connect_error(PRInt32 err)
166 PRErrorCode prError;
167 switch (err) {
168 // case WSAEWOULDBLOCK: prError = PR_IN_PROGRESS_ERROR; break;
169 // case WSAEINVAL: prError = PR_ALREADY_INITIATED_ERROR; break;
170 // case WSAETIMEDOUT: prError = PR_IO_TIMEOUT_ERROR; break;
171 default: nss_MD_os2_map_default_error(err); return;
173 PR_SetError(prError, err);
176 void nss_MD_os2_map_bind_error(PRInt32 err)
178 PRErrorCode prError;
179 switch (err) {
180 // case WSAEINVAL: prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; break;
181 default: nss_MD_os2_map_default_error(err); return;
183 PR_SetError(prError, err);
186 void nss_MD_os2_map_listen_error(PRInt32 err)
188 PRErrorCode prError;
189 switch (err) {
190 // case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break;
191 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
192 default: nss_MD_os2_map_default_error(err); return;
194 PR_SetError(prError, err);
197 void nss_MD_os2_map_shutdown_error(PRInt32 err)
199 nss_MD_os2_map_default_error(err);
202 void nss_MD_os2_map_getsockname_error(PRInt32 err)
204 PRErrorCode prError;
205 switch (err) {
206 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
207 default: nss_MD_os2_map_default_error(err); return;
209 PR_SetError(prError, err);
212 void nss_MD_os2_map_getpeername_error(PRInt32 err)
214 nss_MD_os2_map_default_error(err);
217 void nss_MD_os2_map_getsockopt_error(PRInt32 err)
219 nss_MD_os2_map_default_error(err);
222 void nss_MD_os2_map_setsockopt_error(PRInt32 err)
224 nss_MD_os2_map_default_error(err);
227 void nss_MD_os2_map_open_error(PRInt32 err)
229 nss_MD_os2_map_default_error(err);
232 void nss_MD_os2_map_gethostname_error(PRInt32 err)
234 nss_MD_os2_map_default_error(err);
237 /* Win32 select() only works on sockets. So in this
238 ** context, WSAENOTSOCK is equivalent to EBADF on Unix.
240 void nss_MD_os2_map_select_error(PRInt32 err)
242 PRErrorCode prError;
243 switch (err) {
244 // case WSAENOTSOCK: prError = PR_BAD_DESCRIPTOR_ERROR; break;
245 default: nss_MD_os2_map_default_error(err); return;
247 PR_SetError(prError, err);
250 void nss_MD_os2_map_lockf_error(PRInt32 err)
252 nss_MD_os2_map_default_error(err);
257 void nss_MD_os2_map_default_error(PRInt32 err)
259 PRErrorCode prError;
261 switch (err) {
262 // case ENOENT: prError = PR_FILE_NOT_FOUND_ERROR; break;
263 // case ERROR_ACCESS_DENIED: prError = PR_NO_ACCESS_RIGHTS_ERROR; break;
264 // case ERROR_ALREADY_EXISTS: prError = PR_FILE_EXISTS_ERROR; break;
265 // case ERROR_DISK_CORRUPT: prError = PR_IO_ERROR; break;
266 // case ERROR_DISK_FULL: prError = PR_NO_DEVICE_SPACE_ERROR; break;
267 // case ERROR_DISK_OPERATION_FAILED: prError = PR_IO_ERROR; break;
268 // case ERROR_DRIVE_LOCKED: prError = PR_FILE_IS_LOCKED_ERROR; break;
269 // case ERROR_FILENAME_EXCED_RANGE: prError = PR_NAME_TOO_LONG_ERROR; break;
270 // case ERROR_FILE_CORRUPT: prError = PR_IO_ERROR; break;
271 // case ERROR_FILE_EXISTS: prError = PR_FILE_EXISTS_ERROR; break;
272 // case ERROR_FILE_INVALID: prError = PR_BAD_DESCRIPTOR_ERROR; break;
273 #if ERROR_FILE_NOT_FOUND != ENOENT
274 // case ERROR_FILE_NOT_FOUND: prError = PR_FILE_NOT_FOUND_ERROR; break;
275 #endif
276 default: prError = PR_UNKNOWN_ERROR; break;
278 PR_SetError(prError, err);