📄 apr_errno.h
字号:
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef APR_ERRNO_H
#define APR_ERRNO_H
/**
* @file apr_errno.h
* @brief APR Error Codes
*/
#include "apr.h"
#if APR_HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup apr_errno Error Codes
* @ingroup APR
* @{
*/
/**
* Type for specifying an error or status code.
*/
typedef int apr_status_t;
/**
* Return a human readable string describing the specified error.
* @param statcode The error code the get a string for.
* @param buf A buffer to hold the error string.
* @param bufsize Size of the buffer to hold the string.
*/
APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
apr_size_t bufsize);
#if defined(DOXYGEN)
/**
* @def APR_FROM_OS_ERROR(os_err_type syserr)
* Fold a platform specific error into an apr_status_t code.
* @return apr_status_t
* @param e The platform os error code.
* @warning macro implementation; the syserr argument may be evaluated
* multiple times.
*/
#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
/**
* @def APR_TO_OS_ERROR(apr_status_t statcode)
* @return os_err_type
* Fold an apr_status_t code back to the native platform defined error.
* @param 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) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
/** @def apr_get_os_error()
* @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
* @remark 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!
*/
/** @def apr_set_os_error(e)
* Reset the last platform error, unfolded from an apr_status_t, on some platforms
* @param 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.
*/
/** @def apr_get_netos_error()
* Return the last socket error, folded into apr_status_t, on all platforms
* @remark This retrieves errno or calls a GetLastSocketError() style function,
* and folds it with APR_FROM_OS_ERROR.
*/
/** @def apr_set_netos_error(e)
* Reset the last socket error, unfolded from an apr_status_t
* @param 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.
*/
#endif /* defined(DOXYGEN) */
/**
* APR_OS_START_ERROR is where the APR specific error values start.
*/
#define APR_OS_START_ERROR 20000
/**
* 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_ERRSPACE_SIZE 50000
/**
* APR_OS_START_STATUS is where the APR specific status codes start.
*/
#define APR_OS_START_STATUS (APR_OS_START_ERROR + 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.
*/
#define APR_OS_START_USERERR (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE)
/**
* APR_OS_START_USEERR is obsolete, defined for compatibility only.
* Use APR_OS_START_USERERR instead.
*/
#define APR_OS_START_USEERR APR_OS_START_USERERR
/**
* 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_CANONERR (APR_OS_START_USERERR \
+ (APR_OS_ERRSPACE_SIZE * 10))
/**
* APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
* apr_status_t values.
*/
#define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE)
/**
* APR_OS_START_SYSERR folds platform-specific system error values into
* apr_status_t values.
*/
#define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE)
/** no error. @see APR_STATUS_IS_SUCCESS */
#define APR_SUCCESS 0
/**
* @defgroup APR_Error APR Error Values
* <PRE>
* <b>APR ERROR VALUES</b>
* APR_ENOSTAT APR was unable to perform a stat on the file
* APR_ENOPOOL APR was not provided a pool with which to allocate memory
* APR_EBADDATE APR was given an invalid date
* APR_EINVALSOCK APR was given an invalid socket
* APR_ENOPROC APR was not given a process structure
* APR_ENOTIME APR was not given a time structure
* APR_ENODIR APR was not given a directory structure
* APR_ENOLOCK APR was not given a lock structure
* APR_ENOPOLL APR was not given a poll structure
* APR_ENOSOCKET APR was not given a socket
* APR_ENOTHREAD APR was not given a thread structure
* APR_ENOTHDKEY APR was not given a thread key structure
* APR_ENOSHMAVAIL There is no more shared memory available
* APR_EDSOOPEN APR was unable to open the dso object. For more
* information call apr_dso_error().
* APR_EGENERAL General failure (specific information not available)
* APR_EBADIP The specified IP address is invalid
* APR_EBADMASK The specified netmask is invalid
* APR_ESYMNOTFOUND Could not find the requested symbol
* </PRE>
*
* <PRE>
* <b>APR STATUS VALUES</b>
* APR_INCHILD Program is currently executing in the child
* APR_INPARENT Program is currently executing in the parent
* APR_DETACH The thread is detached
* APR_NOTDETACH The thread is not detached
* APR_CHILD_DONE The child has finished executing
* APR_CHILD_NOTDONE The child has not finished executing
* APR_TIMEUP The operation did not finish before the timeout
* APR_INCOMPLETE The operation was incomplete although some processing
* was performed and the results are partially valid
* APR_BADCH Getopt found an option not in the option string
* APR_BADARG Getopt found an option that is missing an argument
* and an argument was specified in the option string
* APR_EOF APR has encountered the end of the file
* APR_NOTFOUND APR was unable to find the socket in the poll structure
* APR_ANONYMOUS APR is using anonymous shared memory
* APR_FILEBASED APR is using a file name as the key to the shared memory
* APR_KEYBASED APR is using a shared key as the key to the shared memory
* APR_EINIT Ininitalizer value. If no option has been found, but
* the status variable requires a value, this should be used
* APR_ENOTIMPL The APR function has not been implemented on this
* platform, either because nobody has gotten to it yet,
* or the function is impossible on this platform.
* APR_EMISMATCH Two passwords do not match.
* APR_EABSOLUTE The given path was absolute.
* APR_ERELATIVE The given path was relative.
* APR_EINCOMPLETE The given path was neither relative nor absolute.
* APR_EABOVEROOT The given path was above the root path.
* APR_EBUSY The given lock was busy.
* APR_EPROC_UNKNOWN The given process wasn't recognized by APR
* </PRE>
* @{
*/
/** @see APR_STATUS_IS_ENOSTAT */
#define APR_ENOSTAT (APR_OS_START_ERROR + 1)
/** @see APR_STATUS_IS_ENOPOOL */
#define APR_ENOPOOL (APR_OS_START_ERROR + 2)
/* empty slot: +3 */
/** @see APR_STATUS_IS_EBADDATE */
#define APR_EBADDATE (APR_OS_START_ERROR + 4)
/** @see APR_STATUS_IS_EINVALSOCK */
#define APR_EINVALSOCK (APR_OS_START_ERROR + 5)
/** @see APR_STATUS_IS_ENOPROC */
#define APR_ENOPROC (APR_OS_START_ERROR + 6)
/** @see APR_STATUS_IS_ENOTIME */
#define APR_ENOTIME (APR_OS_START_ERROR + 7)
/** @see APR_STATUS_IS_ENODIR */
#define APR_ENODIR (APR_OS_START_ERROR + 8)
/** @see APR_STATUS_IS_ENOLOCK */
#define APR_ENOLOCK (APR_OS_START_ERROR + 9)
/** @see APR_STATUS_IS_ENOPOLL */
#define APR_ENOPOLL (APR_OS_START_ERROR + 10)
/** @see APR_STATUS_IS_ENOSOCKET */
#define APR_ENOSOCKET (APR_OS_START_ERROR + 11)
/** @see APR_STATUS_IS_ENOTHREAD */
#define APR_ENOTHREAD (APR_OS_START_ERROR + 12)
/** @see APR_STATUS_IS_ENOTHDKEY */
#define APR_ENOTHDKEY (APR_OS_START_ERROR + 13)
/** @see APR_STATUS_IS_EGENERAL */
#define APR_EGENERAL (APR_OS_START_ERROR + 14)
/** @see APR_STATUS_IS_ENOSHMAVAIL */
#define APR_ENOSHMAVAIL (APR_OS_START_ERROR + 15)
/** @see APR_STATUS_IS_EBADIP */
#define APR_EBADIP (APR_OS_START_ERROR + 16)
/** @see APR_STATUS_IS_EBADMASK */
#define APR_EBADMASK (APR_OS_START_ERROR + 17)
/* empty slot: +18 */
/** @see APR_STATUS_IS_EDSOPEN */
#define APR_EDSOOPEN (APR_OS_START_ERROR + 19)
/** @see APR_STATUS_IS_EABSOLUTE */
#define APR_EABSOLUTE (APR_OS_START_ERROR + 20)
/** @see APR_STATUS_IS_ERELATIVE */
#define APR_ERELATIVE (APR_OS_START_ERROR + 21)
/** @see APR_STATUS_IS_EINCOMPLETE */
#define APR_EINCOMPLETE (APR_OS_START_ERROR + 22)
/** @see APR_STATUS_IS_EABOVEROOT */
#define APR_EABOVEROOT (APR_OS_START_ERROR + 23)
/** @see APR_STATUS_IS_EBADPATH */
#define APR_EBADPATH (APR_OS_START_ERROR + 24)
/** @see APR_STATUS_IS_EPATHWILD */
#define APR_EPATHWILD (APR_OS_START_ERROR + 25)
/** @see APR_STATUS_IS_ESYMNOTFOUND */
#define APR_ESYMNOTFOUND (APR_OS_START_ERROR + 26)
/** @see APR_STATUS_IS_EPROC_UNKNOWN */
#define APR_EPROC_UNKNOWN (APR_OS_START_ERROR + 27)
/** @} */
/**
* @defgroup APR_STATUS_IS Status Value Tests
* @warning For any particular error condition, more than one of these tests
* may match. This is because platform-specific error codes may not
* always match the semantics of the POSIX codes these tests (and the
* correcponding APR error codes) are named after. A notable example
* are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
* Win32 platforms. The programmer should always be aware of this and
* adjust the order of the tests accordingly.
* @{
*/
/**
* APR was unable to perform a stat on the file
* @warning always use this test, as platform-specific variances may meet this
* more than one error code
*/
#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT)
/**
* APR was not provided a pool with which to allocate memory
* @warning always use this test, as platform-specific variances may meet this
* more than one error code
*/
#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL)
/** APR was given an invalid date */
#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE)
/** APR was given an invalid socket */
#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK)
/** APR was not given a process structure */
#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC)
/** APR was not given a time structure */
#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME)
/** APR was not given a directory structure */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -