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