~ubuntu-branches/ubuntu/saucy/nspr/saucy-updates

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/src/md/windows/w16error.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2009-08-10 11:34:26 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810113426-3uv4diflrkcbdimm
Tags: 4.8-0ubuntu1
* New upstream release: 4.8 (LP: #387812)
* adjust patches to changed upstreanm codebase
  - update debian/patches/99_configure.patch
* update shlibs symbols to include new API elements
  - update debian/libnspr4-0d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
 
 *
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/
9
 
 *
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
13
 
 * License.
14
 
 *
15
 
 * The Original Code is the Netscape Portable Runtime (NSPR).
16
 
 *
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.
21
 
 *
22
 
 * Contributor(s):
23
 
 *
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.
35
 
 *
36
 
 * ***** END LICENSE BLOCK ***** */
37
 
 
38
 
/*
39
 
** Note: A single error mapping function is provided.
40
 
**
41
 
*/ 
42
 
#include "prerror.h"
43
 
#include <errno.h>
44
 
#include <winsock.h>
45
 
 
46
 
 
47
 
void _PR_MD_map_error( int err )
48
 
{
49
 
 
50
 
    switch ( err )
51
 
    {
52
 
        case  ENOENT:   /* No such file or directory */
53
 
                        PR_SetError(PR_FILE_NOT_FOUND_ERROR, err);
54
 
            break;
55
 
        case  E2BIG:    /* Argument list too big */
56
 
            PR_SetError( PR_INVALID_ARGUMENT_ERROR, err );
57
 
            break;
58
 
        case  ENOEXEC:  /* Exec format error */
59
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
60
 
            break;
61
 
        case  EBADF:    /* Bad file number */
62
 
            PR_SetError( PR_BAD_DESCRIPTOR_ERROR, err );
63
 
            break;
64
 
        case  ENOMEM:   /* Not enough Memory */
65
 
            PR_SetError( PR_OUT_OF_MEMORY_ERROR, err );
66
 
            break;
67
 
        case  EACCES:   /* Permission denied */
68
 
            PR_SetError( PR_NO_ACCESS_RIGHTS_ERROR, err );
69
 
            break;
70
 
        case  EEXIST:   /* File exists */
71
 
        
72
 
 /* RESTART here */
73
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
74
 
            break;
75
 
        case  EXDEV:    /* Cross device link */
76
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
77
 
            break;
78
 
        case  EINVAL:   /* Invalid argument */
79
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
80
 
            break;
81
 
        case  ENFILE:   /* File table overflow */
82
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
83
 
            break;
84
 
        case  EMFILE:   /* Too many open files */
85
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
86
 
            break;
87
 
        case  ENOSPC:   /* No space left on device */
88
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
89
 
            break;
90
 
        /* math errors */
91
 
        case  EDOM:     /* Argument too large */
92
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
93
 
            break;
94
 
        case  ERANGE:   /* Result too large */
95
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
96
 
            break;
97
 
        /* file locking error */
98
 
        case  EDEADLK:      /* Resource deadlock would occur */
99
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
100
 
            break;
101
 
        case  EINTR:    /* Interrupt */
102
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
103
 
            break;
104
 
        case  ECHILD:   /* Child does not exist */
105
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
106
 
            break;
107
 
        /* POSIX errors */
108
 
        case  EAGAIN:   /* Resource unavailable, try again */
109
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
110
 
            break;
111
 
        case  EBUSY:    /* Device or Resource is busy */
112
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
113
 
            break;
114
 
        case  EFBIG:    /* File too large */
115
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
116
 
            break;
117
 
        case  EIO:      /* I/O error */
118
 
            PR_SetError( PR_IO_ERROR, err );
119
 
            break;
120
 
        case  EISDIR:   /* Is a directory */
121
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
122
 
            break;
123
 
        case  ENOTDIR:  /* Not a directory */
124
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
125
 
            break;
126
 
        case  EMLINK:   /* Too many links */
127
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
128
 
            break;
129
 
        case  ENOTBLK:  /* Block device required */
130
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
131
 
            break;
132
 
        case  ENOTTY:   /* Not a character device */
133
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
134
 
            break;
135
 
        case  ENXIO:    /* No such device or address */
136
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
137
 
            break;
138
 
        case  EPERM:    /* Not owner */
139
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
140
 
            break;
141
 
        case  EPIPE:    /* Broken pipe */
142
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
143
 
            break;
144
 
        case  EROFS:    /* Read only file system */
145
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
146
 
            break;
147
 
        case  ESPIPE:   /* Illegal seek */
148
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
149
 
            break;
150
 
        case  ESRCH:    /* No such process */
151
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
152
 
            break;
153
 
        case  ETXTBSY:  /* Text file busy */
154
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
155
 
            break;
156
 
        case  EFAULT:   /* Bad address */
157
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
158
 
            break;
159
 
        case  ENAMETOOLONG: /* Name too long */
160
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
161
 
            break;
162
 
        case  ENODEV:   /* No such device */
163
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
164
 
            break;
165
 
        case  ENOLCK:   /* No locks available on system */
166
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
167
 
            break;
168
 
        case  ENOSYS:   /* Unknown system call */
169
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
170
 
            break;
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 );
175
 
            break;
176
 
            
177
 
        /* WinSock errors */
178
 
        case WSAEACCES:
179
 
            PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, err);
180
 
            break;
181
 
        case WSAEADDRINUSE:
182
 
            PR_SetError(PR_ADDRESS_IN_USE_ERROR, err);
183
 
            break;
184
 
        case WSAEADDRNOTAVAIL:
185
 
            PR_SetError(PR_ADDRESS_NOT_AVAILABLE_ERROR, err);
186
 
            break;
187
 
        case WSAEAFNOSUPPORT:
188
 
            PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, err);
189
 
            break;
190
 
        case WSAEBADF:
191
 
            PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);
192
 
            break;
193
 
        case WSAECONNREFUSED:
194
 
            PR_SetError(PR_CONNECT_REFUSED_ERROR, err);
195
 
            break;
196
 
        case WSAEFAULT:
197
 
            PR_SetError(PR_ACCESS_FAULT_ERROR, err);
198
 
            break;
199
 
        case WSAEINVAL:
200
 
            PR_SetError(PR_BUFFER_OVERFLOW_ERROR, err);
201
 
            break;
202
 
        case WSAEISCONN:
203
 
            PR_SetError(PR_IS_CONNECTED_ERROR, err);
204
 
            break;
205
 
        case WSAEMFILE:
206
 
            PR_SetError(PR_PROC_DESC_TABLE_FULL_ERROR, err);
207
 
            break;
208
 
        case WSAENETDOWN:
209
 
        case WSAENETUNREACH:
210
 
            PR_SetError(PR_NETWORK_UNREACHABLE_ERROR, err);
211
 
            break;
212
 
        case WSAENOBUFS:
213
 
            PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, err);
214
 
            break;
215
 
        case WSAENOPROTOOPT:
216
 
        case WSAEMSGSIZE:
217
 
            PR_SetError(PR_INVALID_ARGUMENT_ERROR, err);
218
 
            break;
219
 
        case WSAENOTCONN:
220
 
            PR_SetError(PR_NOT_CONNECTED_ERROR, err);
221
 
            break;
222
 
        case WSAENOTSOCK:
223
 
            PR_SetError(PR_NOT_SOCKET_ERROR, err);
224
 
            break;
225
 
        case WSAEOPNOTSUPP:
226
 
            PR_SetError(PR_NOT_TCP_SOCKET_ERROR, err);
227
 
            break;
228
 
        case WSAEPROTONOSUPPORT:
229
 
            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
230
 
            break;
231
 
        case WSAETIMEDOUT:
232
 
            PR_SetError(PR_IO_TIMEOUT_ERROR, err);
233
 
            break;
234
 
        case WSAEINTR:
235
 
            PR_SetError(PR_PENDING_INTERRUPT_ERROR, err );
236
 
            break;
237
 
        case WSASYSNOTREADY:
238
 
        case WSAVERNOTSUPPORTED:
239
 
            PR_SetError(PR_PROTOCOL_NOT_SUPPORTED_ERROR, err);
240
 
            break;
241
 
                case WSAEWOULDBLOCK:
242
 
                        PR_SetError(PR_WOULD_BLOCK_ERROR, err);
243
 
                        break;
244
 
            
245
 
        default:
246
 
            PR_SetError( PR_UNKNOWN_ERROR, err );
247
 
            break;
248
 
    }
249
 
    return;
250
 
} /* end _MD_map_win16_error() */
251
 
 
252