xref: /unit/src/nxt_errno.h (revision 1003:a7122e3c6e06)
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_UNIX_ERRNO_H_INCLUDED_
8 #define _NXT_UNIX_ERRNO_H_INCLUDED_
9 
10 
11 typedef int                        nxt_err_t;
12 
13 
14 #define NXT_EPERM                  EPERM
15 #define NXT_ENOENT                 ENOENT
16 #define NXT_ENOPATH                ENOENT
17 #define NXT_ESRCH                  ESRCH
18 #define NXT_EINTR                  EINTR
19 #define NXT_ECHILD                 ECHILD
20 #define NXT_ENOMEM                 ENOMEM
21 #define NXT_EACCES                 EACCES
22 #define NXT_EBUSY                  EBUSY
23 #define NXT_EEXIST                 EEXIST
24 #define NXT_EXDEV                  EXDEV
25 #define NXT_ENOTDIR                ENOTDIR
26 #define NXT_EISDIR                 EISDIR
27 #define NXT_EINVAL                 EINVAL
28 #define NXT_ENOSPC                 ENOSPC
29 #define NXT_EPIPE                  EPIPE
30 #define NXT_EINPROGRESS            EINPROGRESS
31 #define NXT_EOPNOTSUPP             EOPNOTSUPP
32 #define NXT_EADDRINUSE             EADDRINUSE
33 #define NXT_ECONNABORTED           ECONNABORTED
34 #define NXT_ECONNRESET             ECONNRESET
35 #define NXT_ENOTCONN               ENOTCONN
36 #define NXT_ETIMEDOUT              ETIMEDOUT
37 #define NXT_ECONNREFUSED           ECONNREFUSED
38 #define NXT_ENAMETOOLONG           ENAMETOOLONG
39 #define NXT_ENETDOWN               ENETDOWN
40 #define NXT_ENETUNREACH            ENETUNREACH
41 #define NXT_EHOSTDOWN              EHOSTDOWN
42 #define NXT_EHOSTUNREACH           EHOSTUNREACH
43 #define NXT_ENOSYS                 ENOSYS
44 #define NXT_ECANCELED              ECANCELED
45 #define NXT_EILSEQ                 EILSEQ
46 #define NXT_ETIME                  ETIME
47 #define NXT_ENOMOREFILES           0
48 #define NXT_ENOBUFS                ENOBUFS
49 
50 #if (NXT_HPUX)
51 /* HP-UX uses EWOULDBLOCK instead of EAGAIN. */
52 #define NXT_EAGAIN                 EWOULDBLOCK
53 #else
54 #define NXT_EAGAIN                 EAGAIN
55 #endif
56 
57 
58 #define NXT_OK                     0
59 #define NXT_ERROR                  (-1)
60 #define NXT_AGAIN                  (-2)
61 #define NXT_DECLINED               (-3)
62 #define NXT_DONE                   (-4)
63 
64 
65 #define                                                                       \
66 nxt_errno                                                                     \
67     errno
68 
69 #define                                                                       \
70 nxt_socket_errno                                                              \
71     errno
72 
73 #define                                                                       \
74 nxt_set_errno(err)                                                            \
75     errno = err
76 
77 #define                                                                       \
78 nxt_set_socket_errno(err)                                                     \
79     errno = err
80 
81 
82 nxt_int_t nxt_strerror_start(void);
83 
84 
85 typedef u_char *(*nxt_strerror_t)(nxt_err_t err, u_char *errstr, size_t size);
86 extern nxt_strerror_t  nxt_strerror;
87 
88 
89 #endif /* _NXT_UNIX_ERRNO_H_INCLUDED_ */
90