1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is the Netscape Portable Runtime (NSPR).
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998-2000
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
39
** Note: A single error mapping function is provided.
47
void _PR_MD_map_error( int err )
52
case ENOENT: /* No such file or directory */
53
PR_SetError(PR_FILE_NOT_FOUND_ERROR, err);
55
case E2BIG: /* Argument list too big */
56
PR_SetError( PR_INVALID_ARGUMENT_ERROR, err );
58
case ENOEXEC: /* Exec format error */
59
PR_SetError( PR_UNKNOWN_ERROR, err );
61
case EBADF: /* Bad file number */
62
PR_SetError( PR_BAD_DESCRIPTOR_ERROR, err );
64
case ENOMEM: /* Not enough Memory */
65
PR_SetError( PR_OUT_OF_MEMORY_ERROR, err );
67
case EACCES: /* Permission denied */
68
PR_SetError( PR_NO_ACCESS_RIGHTS_ERROR, err );
70
case EEXIST: /* File exists */
73
PR_SetError( PR_UNKNOWN_ERROR, err );
75
case EXDEV: /* Cross device link */
76
PR_SetError( PR_UNKNOWN_ERROR, err );
78
case EINVAL: /* Invalid argument */
79
PR_SetError( PR_UNKNOWN_ERROR, err );
81
case ENFILE: /* File table overflow */
82
PR_SetError( PR_UNKNOWN_ERROR, err );
84
case EMFILE: /* Too many open files */
85
PR_SetError( PR_UNKNOWN_ERROR, err );
87
case ENOSPC: /* No space left on device */
88
PR_SetError( PR_UNKNOWN_ERROR, err );
91
case EDOM: /* Argument too large */
92
PR_SetError( PR_UNKNOWN_ERROR, err );
94
case ERANGE: /* Result too large */
95
PR_SetError( PR_UNKNOWN_ERROR, err );
97
/* file locking error */
98
case EDEADLK: /* Resource deadlock would occur */
99
PR_SetError( PR_UNKNOWN_ERROR, err );
101
case EINTR: /* Interrupt */
102
PR_SetError( PR_UNKNOWN_ERROR, err );
104
case ECHILD: /* Child does not exist */
105
PR_SetError( PR_UNKNOWN_ERROR, err );
108
case EAGAIN: /* Resource unavailable, try again */
109
PR_SetError( PR_UNKNOWN_ERROR, err );
111
case EBUSY: /* Device or Resource is busy */
112
PR_SetError( PR_UNKNOWN_ERROR, err );
114
case EFBIG: /* File too large */
115
PR_SetError( PR_UNKNOWN_ERROR, err );
117
case EIO: /* I/O error */
118
PR_SetError( PR_IO_ERROR, err );
120
case EISDIR: /* Is a directory */
121
PR_SetError( PR_UNKNOWN_ERROR, err );
123
case ENOTDIR: /* Not a directory */
124
PR_SetError( PR_UNKNOWN_ERROR, err );
126
case EMLINK: /* Too many links */
127
PR_SetError( PR_UNKNOWN_ERROR, err );
129
case ENOTBLK: /* Block device required */
130
PR_SetError( PR_UNKNOWN_ERROR, err );
132
case ENOTTY: /* Not a character device */
133
PR_SetError( PR_UNKNOWN_ERROR, err );
135
case ENXIO: /* No such device or address */
136
PR_SetError( PR_UNKNOWN_ERROR, err );
138
case EPERM: /* Not owner */
139
PR_SetError( PR_UNKNOWN_ERROR, err );
141
case EPIPE: /* Broken pipe */
142
PR_SetError( PR_UNKNOWN_ERROR, err );
144
case EROFS: /* Read only file system */
145
PR_SetError( PR_UNKNOWN_ERROR, err );
147
case ESPIPE: /* Illegal seek */
148
PR_SetError( PR_UNKNOWN_ERROR, err );
150
case ESRCH: /* No such process */
151
PR_SetError( PR_UNKNOWN_ERROR, err );
153
case ETXTBSY: /* Text file busy */
154
PR_SetError( PR_UNKNOWN_ERROR, err );
156
case EFAULT: /* Bad address */
157
PR_SetError( PR_UNKNOWN_ERROR, err );
159
case ENAMETOOLONG: /* Name too long */
160
PR_SetError( PR_UNKNOWN_ERROR, err );
162
case ENODEV: /* No such device */
163
PR_SetError( PR_UNKNOWN_ERROR, err );
165
case ENOLCK: /* No locks available on system */
166
PR_SetError( PR_UNKNOWN_ERROR, err );
168
case ENOSYS: /* Unknown system call */
169
PR_SetError( PR_UNKNOWN_ERROR, err );
171
case ENOTEMPTY: /* Directory not empty */
172
/* Normative Addendum error */
173
case EILSEQ: /* Multibyte/widw character encoding error */
174
PR_SetError( PR_UNKNOWN_ERROR, err );
179
PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, err);
182
PR_SetError(PR_ADDRESS_IN_USE_ERROR, err);
184
case WSAEADDRNOTAVAIL:
185
PR_SetError(PR_ADDRESS_NOT_AVAILABLE_ERROR, err);
187
case WSAEAFNOSUPPORT:
188
PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
191
PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
193
case WSAECONNREFUSED:
194
PR_SetError(PR_CONNECT_REFUSED_ERROR, err);
197
PR_SetError(PR_ACCESS_FAULT_ERROR, err);
200
PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
203
PR_SetError(PR_IS_CONNECTED_ERROR, err);
206
PR_SetError(PR_PROC_DESC_TABLE_FULL_ERROR, err);
210
PR_SetError(PR_NETWORK_UNREACHABLE_ERROR, err);
213
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
217
PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
220
PR_SetError(PR_NOT_CONNECTED_ERROR, err);
223
PR_SetError(PR_NOT_SOCKET_ERROR, err);
226
PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
228
case WSAEPROTONOSUPPORT:
229
PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
232
PR_SetError(PR_IO_TIMEOUT_ERROR, err);
235
PR_SetError(PR_PENDING_INTERRUPT_ERROR, err );
238
case WSAVERNOTSUPPORTED:
239
PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
242
PR_SetError(PR_WOULD_BLOCK_ERROR, err);
246
PR_SetError( PR_UNKNOWN_ERROR, err );
250
} /* end _MD_map_win16_error() */