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