xref: /unit/src/nxt_errno.h (revision 0:a63ceefd6ab0)
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 
49 #if (NXT_HPUX)
50 /* HP-UX uses EWOULDBLOCK instead of EAGAIN. */
51 #define NXT_EAGAIN                 EWOULDBLOCK
52 #else
53 #define NXT_EAGAIN                 EAGAIN
54 #endif
55 
56 
57 #define NXT_OK                     0
58 #define NXT_ERROR                  (-1)
59 #define NXT_AGAIN                  (-2)
60 #define NXT_DECLINED               (-3)
61 #define NXT_DONE                   (-4)
62 
63 
64 #define                                                                       \
65 nxt_errno                                                                     \
66     errno
67 
68 #define                                                                       \
69 nxt_socket_errno                                                              \
70     errno
71 
72 #define                                                                       \
73 nxt_set_errno(err)                                                            \
74     errno = err
75 
76 #define                                                                       \
77 nxt_set_socket_errno(err)                                                     \
78     errno = err
79 
80 
81 nxt_int_t nxt_strerror_start(void);
82 
83 
84 typedef u_char *(*nxt_strerror_t)(nxt_err_t err, u_char *errstr, size_t size);
85 extern nxt_strerror_t  nxt_strerror;
86 
87 
88 #endif /* _NXT_UNIX_ERRNO_H_INCLUDED_ */
89