1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#define INCL_DOSERRORS
18
#include "apr_arch_file_io.h"
19
#include "apr_file_io.h"
22
#include "apr_errno.h"
24
static int errormap[][2] = {
25
{ NO_ERROR, APR_SUCCESS },
26
{ ERROR_FILE_NOT_FOUND, APR_ENOENT },
27
{ ERROR_PATH_NOT_FOUND, APR_ENOENT },
28
{ ERROR_TOO_MANY_OPEN_FILES, APR_EMFILE },
29
{ ERROR_ACCESS_DENIED, APR_EACCES },
30
{ ERROR_SHARING_VIOLATION, APR_EACCES },
31
{ ERROR_INVALID_PARAMETER, APR_EINVAL },
32
{ ERROR_OPEN_FAILED, APR_ENOENT },
33
{ ERROR_DISK_FULL, APR_ENOSPC },
34
{ ERROR_FILENAME_EXCED_RANGE, APR_ENAMETOOLONG },
35
{ ERROR_INVALID_FUNCTION, APR_EINVAL },
36
{ ERROR_INVALID_HANDLE, APR_EBADF },
37
{ ERROR_NEGATIVE_SEEK, APR_ESPIPE },
38
{ ERROR_NO_SIGNAL_SENT, ESRCH },
39
{ ERROR_NO_DATA, APR_EAGAIN },
41
{ SOCEWOULDBLOCK, EWOULDBLOCK },
42
{ SOCEINPROGRESS, EINPROGRESS },
43
{ SOCEALREADY, EALREADY },
44
{ SOCENOTSOCK, ENOTSOCK },
45
{ SOCEDESTADDRREQ, EDESTADDRREQ },
46
{ SOCEMSGSIZE, EMSGSIZE },
47
{ SOCEPROTOTYPE, EPROTOTYPE },
48
{ SOCENOPROTOOPT, ENOPROTOOPT },
49
{ SOCEPROTONOSUPPORT, EPROTONOSUPPORT },
50
{ SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT },
51
{ SOCEOPNOTSUPP, EOPNOTSUPP },
52
{ SOCEPFNOSUPPORT, EPFNOSUPPORT },
53
{ SOCEAFNOSUPPORT, EAFNOSUPPORT },
54
{ SOCEADDRINUSE, EADDRINUSE },
55
{ SOCEADDRNOTAVAIL, EADDRNOTAVAIL },
56
{ SOCENETDOWN, ENETDOWN },
57
{ SOCENETUNREACH, ENETUNREACH },
58
{ SOCENETRESET, ENETRESET },
59
{ SOCECONNABORTED, ECONNABORTED },
60
{ SOCECONNRESET, ECONNRESET },
61
{ SOCENOBUFS, ENOBUFS },
62
{ SOCEISCONN, EISCONN },
63
{ SOCENOTCONN, ENOTCONN },
64
{ SOCESHUTDOWN, ESHUTDOWN },
65
{ SOCETOOMANYREFS, ETOOMANYREFS },
66
{ SOCETIMEDOUT, ETIMEDOUT },
67
{ SOCECONNREFUSED, ECONNREFUSED },
69
{ SOCENAMETOOLONG, ENAMETOOLONG },
70
{ SOCEHOSTDOWN, EHOSTDOWN },
71
{ SOCEHOSTUNREACH, EHOSTUNREACH },
72
{ SOCENOTEMPTY, ENOTEMPTY },
76
#define MAPSIZE (sizeof(errormap)/sizeof(errormap[0]))
78
int apr_canonical_error(apr_status_t err)
82
if (err < APR_OS_START_SYSERR)
85
err -= APR_OS_START_SYSERR;
87
for (index=0; index<MAPSIZE && errormap[index][0] != err; index++);
90
rv = errormap[index][1];
92
fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n", err );