~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/file_io/os2/maperrorcode.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
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
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
#define INCL_DOSERRORS
 
18
#include "apr_arch_file_io.h"
 
19
#include "apr_file_io.h"
 
20
#include <errno.h>
 
21
#include <string.h>
 
22
#include "apr_errno.h"
 
23
 
 
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       },
 
40
    { SOCEINTR,                 EINTR           },
 
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    },
 
68
    { SOCELOOP,                 ELOOP           },
 
69
    { SOCENAMETOOLONG,          ENAMETOOLONG    },
 
70
    { SOCEHOSTDOWN,             EHOSTDOWN       },
 
71
    { SOCEHOSTUNREACH,          EHOSTUNREACH    },
 
72
    { SOCENOTEMPTY,             ENOTEMPTY       },
 
73
    { SOCEPIPE,                 EPIPE           }
 
74
};
 
75
 
 
76
#define MAPSIZE (sizeof(errormap)/sizeof(errormap[0]))
 
77
 
 
78
int apr_canonical_error(apr_status_t err)
 
79
{
 
80
    int rv = -1, index;
 
81
 
 
82
    if (err < APR_OS_START_SYSERR)
 
83
        return err;
 
84
 
 
85
    err -= APR_OS_START_SYSERR;
 
86
 
 
87
    for (index=0; index<MAPSIZE && errormap[index][0] != err; index++);
 
88
    
 
89
    if (index<MAPSIZE)
 
90
        rv = errormap[index][1];
 
91
    else
 
92
        fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n", err );
 
93
        
 
94
    return rv;
 
95
}