1e18a033bSKonstantin Ananyev
2e18a033bSKonstantin Ananyev/*
3e18a033bSKonstantin Ananyev * Copyright (C) Igor Sysoev
4e18a033bSKonstantin Ananyev * Copyright (C) Nginx, Inc.
5e18a033bSKonstantin Ananyev */
6e18a033bSKonstantin Ananyev
7e18a033bSKonstantin Ananyev
8e18a033bSKonstantin Ananyev#ifndef _NGX_ERRNO_H_INCLUDED_
9e18a033bSKonstantin Ananyev#define _NGX_ERRNO_H_INCLUDED_
10e18a033bSKonstantin Ananyev
11e18a033bSKonstantin Ananyev
12e18a033bSKonstantin Ananyev#include <ngx_config.h>
13e18a033bSKonstantin Ananyev#include <ngx_core.h>
14e18a033bSKonstantin Ananyev
15e18a033bSKonstantin Ananyev
16e18a033bSKonstantin Ananyevtypedef DWORD                      ngx_err_t;
17e18a033bSKonstantin Ananyev
18e18a033bSKonstantin Ananyev#define ngx_errno                  GetLastError()
19e18a033bSKonstantin Ananyev#define ngx_set_errno(err)         SetLastError(err)
20e18a033bSKonstantin Ananyev#define ngx_socket_errno           WSAGetLastError()
21e18a033bSKonstantin Ananyev#define ngx_set_socket_errno(err)  WSASetLastError(err)
22e18a033bSKonstantin Ananyev
23e18a033bSKonstantin Ananyev#define NGX_EPERM                  ERROR_ACCESS_DENIED
24e18a033bSKonstantin Ananyev#define NGX_ENOENT                 ERROR_FILE_NOT_FOUND
25e18a033bSKonstantin Ananyev#define NGX_ENOPATH                ERROR_PATH_NOT_FOUND
26e18a033bSKonstantin Ananyev#define NGX_ENOMEM                 ERROR_NOT_ENOUGH_MEMORY
27e18a033bSKonstantin Ananyev#define NGX_EACCES                 ERROR_ACCESS_DENIED
28e18a033bSKonstantin Ananyev/*
29e18a033bSKonstantin Ananyev * there are two EEXIST error codes:
30e18a033bSKonstantin Ananyev * ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW),
31e18a033bSKonstantin Ananyev * and ERROR_ALREADY_EXISTS used by CreateDirectory();
32e18a033bSKonstantin Ananyev * MoveFile() uses both
33e18a033bSKonstantin Ananyev */
34e18a033bSKonstantin Ananyev#define NGX_EEXIST                 ERROR_ALREADY_EXISTS
35e18a033bSKonstantin Ananyev#define NGX_EEXIST_FILE            ERROR_FILE_EXISTS
36e18a033bSKonstantin Ananyev#define NGX_EXDEV                  ERROR_NOT_SAME_DEVICE
37e18a033bSKonstantin Ananyev#define NGX_ENOTDIR                ERROR_PATH_NOT_FOUND
38e18a033bSKonstantin Ananyev#define NGX_EISDIR                 ERROR_CANNOT_MAKE
39e18a033bSKonstantin Ananyev#define NGX_ENOSPC                 ERROR_DISK_FULL
40e18a033bSKonstantin Ananyev#define NGX_EPIPE                  EPIPE
41e18a033bSKonstantin Ananyev#define NGX_EAGAIN                 WSAEWOULDBLOCK
42e18a033bSKonstantin Ananyev#define NGX_EINPROGRESS            WSAEINPROGRESS
43e18a033bSKonstantin Ananyev#define NGX_ENOPROTOOPT            WSAENOPROTOOPT
44e18a033bSKonstantin Ananyev#define NGX_EOPNOTSUPP             WSAEOPNOTSUPP
45e18a033bSKonstantin Ananyev#define NGX_EADDRINUSE             WSAEADDRINUSE
46e18a033bSKonstantin Ananyev#define NGX_ECONNABORTED           WSAECONNABORTED
47e18a033bSKonstantin Ananyev#define NGX_ECONNRESET             WSAECONNRESET
48e18a033bSKonstantin Ananyev#define NGX_ENOTCONN               WSAENOTCONN
49e18a033bSKonstantin Ananyev#define NGX_ETIMEDOUT              WSAETIMEDOUT
50e18a033bSKonstantin Ananyev#define NGX_ECONNREFUSED           WSAECONNREFUSED
51e18a033bSKonstantin Ananyev#define NGX_ENAMETOOLONG           ERROR_BAD_PATHNAME
52e18a033bSKonstantin Ananyev#define NGX_ENETDOWN               WSAENETDOWN
53e18a033bSKonstantin Ananyev#define NGX_ENETUNREACH            WSAENETUNREACH
54e18a033bSKonstantin Ananyev#define NGX_EHOSTDOWN              WSAEHOSTDOWN
55e18a033bSKonstantin Ananyev#define NGX_EHOSTUNREACH           WSAEHOSTUNREACH
56e18a033bSKonstantin Ananyev#define NGX_ENOMOREFILES           ERROR_NO_MORE_FILES
57e18a033bSKonstantin Ananyev#define NGX_EILSEQ                 ERROR_NO_UNICODE_TRANSLATION
58e18a033bSKonstantin Ananyev#define NGX_ELOOP                  0
59e18a033bSKonstantin Ananyev#define NGX_EBADF                  WSAEBADF
60e18a033bSKonstantin Ananyev
61e18a033bSKonstantin Ananyev#define NGX_EALREADY               WSAEALREADY
62e18a033bSKonstantin Ananyev#define NGX_EINVAL                 WSAEINVAL
63e18a033bSKonstantin Ananyev#define NGX_EMFILE                 WSAEMFILE
64e18a033bSKonstantin Ananyev#define NGX_ENFILE                 WSAEMFILE
65e18a033bSKonstantin Ananyev
66e18a033bSKonstantin Ananyev
67e18a033bSKonstantin Ananyevu_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
68e18a033bSKonstantin Ananyevngx_int_t ngx_strerror_init(void);
69e18a033bSKonstantin Ananyev
70e18a033bSKonstantin Ananyev
71e18a033bSKonstantin Ananyev#endif /* _NGX_ERRNO_H_INCLUDED_ */
72