upstream nginx-0.7.31
[nginx.git] / nginx / src / os / unix / ngx_errno.h
1
2 /*
3  * Copyright (C) Igor Sysoev
4  */
5
6
7 #ifndef _NGX_ERRNO_H_INCLUDED_
8 #define _NGX_ERRNO_H_INCLUDED_
9
10
11 #include <ngx_config.h>
12 #include <ngx_core.h>
13
14
15 typedef int               ngx_err_t;
16
17 #define NGX_EPERM         EPERM
18 #define NGX_ENOENT        ENOENT
19 #define NGX_ESRCH         ESRCH
20 #define NGX_EINTR         EINTR
21 #define NGX_ECHILD        ECHILD
22 #define NGX_ENOMEM        ENOMEM
23 #define NGX_EACCES        EACCES
24 #define NGX_EBUSY         EBUSY
25 #define NGX_EEXIST        EEXIST
26 #define NGX_EXDEV         EXDEV
27 #define NGX_ENOTDIR       ENOTDIR
28 #define NGX_EISDIR        EISDIR
29 #define NGX_EINVAL        EINVAL
30 #define NGX_ENOSPC        ENOSPC
31 #define NGX_EPIPE         EPIPE
32 #define NGX_EAGAIN        EAGAIN
33 #define NGX_EINPROGRESS   EINPROGRESS
34 #define NGX_EADDRINUSE    EADDRINUSE
35 #define NGX_ECONNABORTED  ECONNABORTED
36 #define NGX_ECONNRESET    ECONNRESET
37 #define NGX_ENOTCONN      ENOTCONN
38 #define NGX_ETIMEDOUT     ETIMEDOUT
39 #define NGX_ECONNREFUSED  ECONNREFUSED
40 #define NGX_ENAMETOOLONG  ENAMETOOLONG
41 #define NGX_ENETDOWN      ENETDOWN
42 #define NGX_ENETUNREACH   ENETUNREACH
43 #define NGX_EHOSTDOWN     EHOSTDOWN
44 #define NGX_EHOSTUNREACH  EHOSTUNREACH
45 #define NGX_ENOSYS        ENOSYS
46 #define NGX_ECANCELED     ECANCELED
47 #define NGX_ENOMOREFILES  0
48
49
50
51 #define ngx_errno                  errno
52 #define ngx_socket_errno           errno
53 #define ngx_set_errno(err)         errno = err
54 #define ngx_set_socket_errno(err)  errno = err
55
56
57 #if (NGX_HAVE_STRERROR_R || NGX_HAVE_GNU_STRERROR_R)
58
59 u_char *ngx_strerror_r(int err, u_char *errstr, size_t size);
60
61 #else
62
63 /* Solaris and Tru64 UNIX have thread-safe strerror() */
64
65 #define ngx_strerror_r(err, errstr, size)  \
66     ngx_cpystrn(errstr, (u_char *) strerror(err), size)
67
68 #endif
69
70
71 #endif /* _NGX_ERRNO_H_INCLUDED_ */