Error Codes
[Apache Portability Runtime library]


Modules

 APR Error Space
 APR Error Values
 Status Value Tests

Defines

#define APR_FROM_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
#define APR_FROM_OS_ERROR(e)   (e)
#define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
#define APR_TO_OS_ERROR(e)   (e)
#define apr_get_os_error()   (errno)
#define apr_set_os_error(e)   (errno = (e))
#define apr_get_netos_error()   (errno)
#define apr_set_netos_error(e)   (errno = (e))
#define APR_OS_START_ERROR   20000
#define APR_OS_ERRSPACE_SIZE   50000
#define APR_UTIL_ERRSPACE_SIZE   20000
#define APR_OS_START_STATUS   (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
#define APR_UTIL_START_STATUS
#define APR_OS_START_USERERR   (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
#define APR_OS_START_USEERR   APR_OS_START_USERERR
#define APR_OS_START_CANONERR
#define APR_OS_START_EAIERR   (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
#define APR_OS_START_SYSERR   (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
#define APR_SUCCESS   0

Typedefs

typedef int apr_status_t

Functions

char * apr_strerror (apr_status_t statcode, char *buf, apr_size_t bufsize)

Define Documentation

#define APR_FROM_OS_ERROR (  )     (e)

Fold a platform specific error into an apr_status_t code.

Returns:
apr_status_t
Parameters:
e The platform os error code.
Warning:
macro implementation; the syserr argument may be evaluated multiple times.

#define APR_FROM_OS_ERROR (  )     (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)

Fold a platform specific error into an apr_status_t code.

Returns:
apr_status_t
Parameters:
e The platform os error code.
Warning:
macro implementation; the syserr argument may be evaluated multiple times.

 
#define apr_get_netos_error (  )     (errno)

Return the last socket error, folded into apr_status_t, on all platforms

Remarks:
This retrieves errno or calls a GetLastSocketError() style function, and folds it with APR_FROM_OS_ERROR.

 
#define apr_get_os_error (  )     (errno)

Returns:
apr_status_t the last platform error, folded into apr_status_t, on most platforms
Remarks:
This retrieves errno, or calls a GetLastError() style function, and folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no such mechanism, so this call may be unsupported. Do NOT use this call for socket errors from socket, send, recv etc!

#define APR_OS_ERRSPACE_SIZE   50000

APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit into one of the error/status ranges below -- except for APR_OS_START_USERERR, which see.

#define APR_OS_START_CANONERR

Value:

APR_OS_START_CANONERR is where APR versions of errno values are defined on systems which don't have the corresponding errno.

#define APR_OS_START_EAIERR   (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)

APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into apr_status_t values.

#define APR_OS_START_ERROR   20000

APR_OS_START_ERROR is where the APR specific error values start.

#define APR_OS_START_STATUS   (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)

APR_OS_START_STATUS is where the APR specific status codes start.

#define APR_OS_START_SYSERR   (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)

APR_OS_START_SYSERR folds platform-specific system error values into apr_status_t values.

#define APR_OS_START_USEERR   APR_OS_START_USERERR

APR_OS_START_USEERR is obsolete, defined for compatibility only. Use APR_OS_START_USERERR instead.

#define APR_OS_START_USERERR   (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)

APR_OS_START_USERERR are reserved for applications that use APR that layer their own error codes along with APR's. Note that the error immediately following this one is set ten times farther away than usual, so that users of apr have a lot of room in which to declare custom error codes.

In general applications should try and create unique error codes. To try and assist in finding suitable ranges of numbers to use, the following ranges are known to be used by the listed applications. If your application defines error codes please advise the range of numbers it uses to dev@apr.apache.org for inclusion in this list.

Ranges shown are in relation to APR_OS_START_USERERR

Subversion - Defined ranges, of less than 100, at intervals of 5000 starting at an offset of 5000, e.g. +5000 to 5100, +10000 to 10100

#define apr_set_netos_error (  )     (errno = (e))

Reset the last socket error, unfolded from an apr_status_t

Parameters:
e The socket error folded in a prior call to APR_FROM_OS_ERROR()
Warning:
This is a macro implementation; the statcode argument may be evaluated multiple times. If the statcode was not created by apr_get_os_error or APR_FROM_OS_ERROR, the results are undefined. This macro sets errno, or calls a WSASetLastError() style function, unfolding socketcode with APR_TO_OS_ERROR.

#define apr_set_os_error (  )     (errno = (e))

Reset the last platform error, unfolded from an apr_status_t, on some platforms

Parameters:
e The OS error folded in a prior call to APR_FROM_OS_ERROR()
Warning:
This is a macro implementation; the statcode argument may be evaluated multiple times. If the statcode was not created by apr_get_os_error or APR_FROM_OS_ERROR, the results are undefined. This macro sets errno, or calls a SetLastError() style function, unfolding statcode with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such mechanism, so this call may be unsupported.

#define APR_SUCCESS   0

no error.

#define APR_TO_OS_ERROR (  )     (e)

Returns:
os_err_type Fold an apr_status_t code back to the native platform defined error.
Parameters:
e The apr_status_t folded platform os error code.
Warning:
macro implementation; the statcode argument may be evaluated multiple times. If the statcode was not created by apr_get_os_error or APR_FROM_OS_ERROR, the results are undefined.

#define APR_TO_OS_ERROR (  )     (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)

Returns:
os_err_type Fold an apr_status_t code back to the native platform defined error.
Parameters:
e The apr_status_t folded platform os error code.
Warning:
macro implementation; the statcode argument may be evaluated multiple times. If the statcode was not created by apr_get_os_error or APR_FROM_OS_ERROR, the results are undefined.

#define APR_UTIL_ERRSPACE_SIZE   20000

APR_UTIL_ERRSPACE_SIZE is the size of the space that is reserved for use within apr-util. This space is reserved above that used by APR internally.

Note:
This number MUST be smaller than APR_OS_ERRSPACE_SIZE by a large enough amount that APR has sufficient room for it's codes.

#define APR_UTIL_START_STATUS

Value:

APR_UTIL_START_STATUS is where APR-Util starts defining it's status codes.


Typedef Documentation

typedef int apr_status_t

Type for specifying an error or status code.


Function Documentation

char* apr_strerror ( apr_status_t  statcode,
char *  buf,
apr_size_t  bufsize 
)

Return a human readable string describing the specified error.

Parameters:
statcode The error code the get a string for.
buf A buffer to hold the error string.
bufsize Size of the buffer to hold the string.


Generated on Sat Aug 16 19:13:41 2008 for Apache Portable Runtime by  doxygen 1.5.6