Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / net / third_party / nss / ssl / os2_err.c
blobaf43f349c1f593b34f55dedd7d00229161954aa5
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/. */
13 /* $Id: os2_err.c,v 1.5 2012/04/25 14:50:12 gerv%gerv.net Exp $ */
15 #include "prerror.h"
16 #include "prlog.h"
17 #include <errno.h>
21 * Based on win32err.c
22 * OS2TODO Stub everything for now to build. HCT
25 /* forward declaration. */
26 void nss_MD_os2_map_default_error(PRInt32 err);
28 void nss_MD_os2_map_opendir_error(PRInt32 err)
30 nss_MD_os2_map_default_error(err);
33 void nss_MD_os2_map_closedir_error(PRInt32 err)
35 nss_MD_os2_map_default_error(err);
38 void nss_MD_os2_map_readdir_error(PRInt32 err)
40 nss_MD_os2_map_default_error(err);
43 void nss_MD_os2_map_delete_error(PRInt32 err)
45 nss_MD_os2_map_default_error(err);
48 /* The error code for stat() is in errno. */
49 void nss_MD_os2_map_stat_error(PRInt32 err)
51 nss_MD_os2_map_default_error(err);
54 void nss_MD_os2_map_fstat_error(PRInt32 err)
56 nss_MD_os2_map_default_error(err);
59 void nss_MD_os2_map_rename_error(PRInt32 err)
61 nss_MD_os2_map_default_error(err);
64 /* The error code for access() is in errno. */
65 void nss_MD_os2_map_access_error(PRInt32 err)
67 nss_MD_os2_map_default_error(err);
70 void nss_MD_os2_map_mkdir_error(PRInt32 err)
72 nss_MD_os2_map_default_error(err);
75 void nss_MD_os2_map_rmdir_error(PRInt32 err)
77 nss_MD_os2_map_default_error(err);
80 void nss_MD_os2_map_read_error(PRInt32 err)
82 nss_MD_os2_map_default_error(err);
85 void nss_MD_os2_map_transmitfile_error(PRInt32 err)
87 nss_MD_os2_map_default_error(err);
90 void nss_MD_os2_map_write_error(PRInt32 err)
92 nss_MD_os2_map_default_error(err);
95 void nss_MD_os2_map_lseek_error(PRInt32 err)
97 nss_MD_os2_map_default_error(err);
100 void nss_MD_os2_map_fsync_error(PRInt32 err)
102 nss_MD_os2_map_default_error(err);
106 * For both CloseHandle() and closesocket().
108 void nss_MD_os2_map_close_error(PRInt32 err)
110 nss_MD_os2_map_default_error(err);
113 void nss_MD_os2_map_socket_error(PRInt32 err)
115 // PR_ASSERT(err != WSANOTINITIALISED);
116 nss_MD_os2_map_default_error(err);
119 void nss_MD_os2_map_recv_error(PRInt32 err)
121 nss_MD_os2_map_default_error(err);
124 void nss_MD_os2_map_recvfrom_error(PRInt32 err)
126 nss_MD_os2_map_default_error(err);
129 void nss_MD_os2_map_send_error(PRInt32 err)
131 PRErrorCode prError;
132 switch (err) {
133 // case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break;
134 default: nss_MD_os2_map_default_error(err); return;
136 PR_SetError(prError, err);
139 void nss_MD_os2_map_sendto_error(PRInt32 err)
141 PRErrorCode prError;
142 switch (err) {
143 // case WSAEMSGSIZE: prError = PR_INVALID_ARGUMENT_ERROR; break;
144 default: nss_MD_os2_map_default_error(err); return;
146 PR_SetError(prError, err);
149 void nss_MD_os2_map_accept_error(PRInt32 err)
151 PRErrorCode prError;
152 switch (err) {
153 // case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break;
154 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
155 default: nss_MD_os2_map_default_error(err); return;
157 PR_SetError(prError, err);
160 void nss_MD_os2_map_acceptex_error(PRInt32 err)
162 nss_MD_os2_map_default_error(err);
165 void nss_MD_os2_map_connect_error(PRInt32 err)
167 PRErrorCode prError;
168 switch (err) {
169 // case WSAEWOULDBLOCK: prError = PR_IN_PROGRESS_ERROR; break;
170 // case WSAEINVAL: prError = PR_ALREADY_INITIATED_ERROR; break;
171 // case WSAETIMEDOUT: prError = PR_IO_TIMEOUT_ERROR; break;
172 default: nss_MD_os2_map_default_error(err); return;
174 PR_SetError(prError, err);
177 void nss_MD_os2_map_bind_error(PRInt32 err)
179 PRErrorCode prError;
180 switch (err) {
181 // case WSAEINVAL: prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; break;
182 default: nss_MD_os2_map_default_error(err); return;
184 PR_SetError(prError, err);
187 void nss_MD_os2_map_listen_error(PRInt32 err)
189 PRErrorCode prError;
190 switch (err) {
191 // case WSAEOPNOTSUPP: prError = PR_NOT_TCP_SOCKET_ERROR; break;
192 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
193 default: nss_MD_os2_map_default_error(err); return;
195 PR_SetError(prError, err);
198 void nss_MD_os2_map_shutdown_error(PRInt32 err)
200 nss_MD_os2_map_default_error(err);
203 void nss_MD_os2_map_getsockname_error(PRInt32 err)
205 PRErrorCode prError;
206 switch (err) {
207 // case WSAEINVAL: prError = PR_INVALID_STATE_ERROR; break;
208 default: nss_MD_os2_map_default_error(err); return;
210 PR_SetError(prError, err);
213 void nss_MD_os2_map_getpeername_error(PRInt32 err)
215 nss_MD_os2_map_default_error(err);
218 void nss_MD_os2_map_getsockopt_error(PRInt32 err)
220 nss_MD_os2_map_default_error(err);
223 void nss_MD_os2_map_setsockopt_error(PRInt32 err)
225 nss_MD_os2_map_default_error(err);
228 void nss_MD_os2_map_open_error(PRInt32 err)
230 nss_MD_os2_map_default_error(err);
233 void nss_MD_os2_map_gethostname_error(PRInt32 err)
235 nss_MD_os2_map_default_error(err);
238 /* Win32 select() only works on sockets. So in this
239 ** context, WSAENOTSOCK is equivalent to EBADF on Unix.
241 void nss_MD_os2_map_select_error(PRInt32 err)
243 PRErrorCode prError;
244 switch (err) {
245 // case WSAENOTSOCK: prError = PR_BAD_DESCRIPTOR_ERROR; break;
246 default: nss_MD_os2_map_default_error(err); return;
248 PR_SetError(prError, err);
251 void nss_MD_os2_map_lockf_error(PRInt32 err)
253 nss_MD_os2_map_default_error(err);
258 void nss_MD_os2_map_default_error(PRInt32 err)
260 PRErrorCode prError;
262 switch (err) {
263 // case ENOENT: prError = PR_FILE_NOT_FOUND_ERROR; break;
264 // case ERROR_ACCESS_DENIED: prError = PR_NO_ACCESS_RIGHTS_ERROR; break;
265 // case ERROR_ALREADY_EXISTS: prError = PR_FILE_EXISTS_ERROR; break;
266 // case ERROR_DISK_CORRUPT: prError = PR_IO_ERROR; break;
267 // case ERROR_DISK_FULL: prError = PR_NO_DEVICE_SPACE_ERROR; break;
268 // case ERROR_DISK_OPERATION_FAILED: prError = PR_IO_ERROR; break;
269 // case ERROR_DRIVE_LOCKED: prError = PR_FILE_IS_LOCKED_ERROR; break;
270 // case ERROR_FILENAME_EXCED_RANGE: prError = PR_NAME_TOO_LONG_ERROR; break;
271 // case ERROR_FILE_CORRUPT: prError = PR_IO_ERROR; break;
272 // case ERROR_FILE_EXISTS: prError = PR_FILE_EXISTS_ERROR; break;
273 // case ERROR_FILE_INVALID: prError = PR_BAD_DESCRIPTOR_ERROR; break;
274 #if ERROR_FILE_NOT_FOUND != ENOENT
275 // case ERROR_FILE_NOT_FOUND: prError = PR_FILE_NOT_FOUND_ERROR; break;
276 #endif
277 default: prError = PR_UNKNOWN_ERROR; break;
279 PR_SetError(prError, err);