xref: /unit/src/nxt_errno.h (revision 2084:7d479274f334)
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 nxt_errno                                                             \
69     errno
70 
71 #define nxt_socket_errno                                                      \
72     errno
73 
74 #define nxt_set_errno(err)                                                    \
75     errno = err
76 
77 #define 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