xref: /unit/src/nxt_errno.h (revision 1855:a946d8cd7f8c)
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_ENXIO                  ENXIO
20 #define NXT_ECHILD                 ECHILD
21 #define NXT_ENOMEM                 ENOMEM
22 #define NXT_EACCES                 EACCES
23 #define NXT_EBUSY                  EBUSY
24 #define NXT_EEXIST                 EEXIST
25 #define NXT_ELOOP                  ELOOP
26 #define NXT_EXDEV                  EXDEV
27 #define NXT_ENOTDIR                ENOTDIR
28 #define NXT_EISDIR                 EISDIR
29 #define NXT_EINVAL                 EINVAL
30 #define NXT_ENOSPC                 ENOSPC
31 #define NXT_EPIPE                  EPIPE
32 #define NXT_EINPROGRESS            EINPROGRESS
33 #define NXT_EOPNOTSUPP             EOPNOTSUPP
34 #define NXT_EADDRINUSE             EADDRINUSE
35 #define NXT_ECONNABORTED           ECONNABORTED
36 #define NXT_ECONNRESET             ECONNRESET
37 #define NXT_ENOTCONN               ENOTCONN
38 #define NXT_ETIMEDOUT              ETIMEDOUT
39 #define NXT_ECONNREFUSED           ECONNREFUSED
40 #define NXT_ENAMETOOLONG           ENAMETOOLONG
41 #define NXT_ENETDOWN               ENETDOWN
42 #define NXT_ENETUNREACH            ENETUNREACH
43 #define NXT_EHOSTDOWN              EHOSTDOWN
44 #define NXT_EHOSTUNREACH           EHOSTUNREACH
45 #define NXT_ENOSYS                 ENOSYS
46 #define NXT_ECANCELED              ECANCELED
47 #define NXT_EILSEQ                 EILSEQ
48 #define NXT_ETIME                  ETIME
49 #define NXT_ENOMOREFILES           0
50 #define NXT_ENOBUFS                ENOBUFS
51 #define NXT_ERANGE                 ERANGE
52 
53 #if (NXT_HPUX)
54 /* HP-UX uses EWOULDBLOCK instead of EAGAIN. */
55 #define NXT_EAGAIN                 EWOULDBLOCK
56 #else
57 #define NXT_EAGAIN                 EAGAIN
58 #endif
59 
60 
61 #define NXT_OK                     0
62 #define NXT_ERROR                  (-1)
63 #define NXT_AGAIN                  (-2)
64 #define NXT_DECLINED               (-3)
65 #define NXT_DONE                   (-4)
66 
67 
68 #define                                                                       \
69 nxt_errno                                                                     \
70     errno
71 
72 #define                                                                       \
73 nxt_socket_errno                                                              \
74     errno
75 
76 #define                                                                       \
77 nxt_set_errno(err)                                                            \
78     errno = err
79 
80 #define                                                                       \
81 nxt_set_socket_errno(err)                                                     \
82     errno = err
83 
84 
85 nxt_int_t nxt_strerror_start(void);
86 
87 
88 typedef u_char *(*nxt_strerror_t)(nxt_err_t err, u_char *errstr, size_t size);
89 extern nxt_strerror_t  nxt_strerror;
90 
91 
92 #endif /* _NXT_UNIX_ERRNO_H_INCLUDED_ */
93