xref: /f-stack/app/nginx-1.16.1/src/core/ngx_config.h (revision 3da8d17d)
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) Nginx, Inc.
5  */
6 
7 
8 #ifndef _NGX_CONFIG_H_INCLUDED_
9 #define _NGX_CONFIG_H_INCLUDED_
10 
11 
12 #include <ngx_auto_headers.h>
13 
14 
15 #if defined __DragonFly__ && !defined __FreeBSD__
16 #define __FreeBSD__        4
17 #define __FreeBSD_version  480101
18 #endif
19 
20 
21 #if (NGX_FREEBSD)
22 #include <ngx_freebsd_config.h>
23 
24 
25 #elif (NGX_LINUX)
26 #include <ngx_linux_config.h>
27 
28 
29 #elif (NGX_SOLARIS)
30 #include <ngx_solaris_config.h>
31 
32 
33 #elif (NGX_DARWIN)
34 #include <ngx_darwin_config.h>
35 
36 
37 #elif (NGX_WIN32)
38 #include <ngx_win32_config.h>
39 
40 
41 #else /* POSIX */
42 #include <ngx_posix_config.h>
43 
44 #endif
45 
46 #if (NGX_HAVE_FSTACK)
47 #include "ff_api.h"
48 #endif
49 
50 #ifndef NGX_HAVE_SO_SNDLOWAT
51 #define NGX_HAVE_SO_SNDLOWAT     1
52 #endif
53 
54 
55 #if !(NGX_WIN32)
56 
57 #define ngx_signal_helper(n)     SIG##n
58 #define ngx_signal_value(n)      ngx_signal_helper(n)
59 
60 #define ngx_random               random
61 
62 /* TODO: #ifndef */
63 #define NGX_SHUTDOWN_SIGNAL      QUIT
64 #define NGX_TERMINATE_SIGNAL     TERM
65 #define NGX_NOACCEPT_SIGNAL      WINCH
66 #define NGX_RECONFIGURE_SIGNAL   HUP
67 
68 #if (NGX_LINUXTHREADS)
69 #define NGX_REOPEN_SIGNAL        INFO
70 #define NGX_CHANGEBIN_SIGNAL     XCPU
71 #else
72 #define NGX_REOPEN_SIGNAL        USR1
73 #define NGX_CHANGEBIN_SIGNAL     USR2
74 #endif
75 
76 #define ngx_cdecl
77 #define ngx_libc_cdecl
78 
79 #endif
80 
81 typedef intptr_t        ngx_int_t;
82 typedef uintptr_t       ngx_uint_t;
83 typedef intptr_t        ngx_flag_t;
84 
85 
86 #define NGX_INT32_LEN   (sizeof("-2147483648") - 1)
87 #define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)
88 
89 #if (NGX_PTR_SIZE == 4)
90 #define NGX_INT_T_LEN   NGX_INT32_LEN
91 #define NGX_MAX_INT_T_VALUE  2147483647
92 
93 #else
94 #define NGX_INT_T_LEN   NGX_INT64_LEN
95 #define NGX_MAX_INT_T_VALUE  9223372036854775807
96 #endif
97 
98 
99 #ifndef NGX_ALIGNMENT
100 #define NGX_ALIGNMENT   sizeof(unsigned long)    /* platform word */
101 #endif
102 
103 #define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
104 #define ngx_align_ptr(p, a)                                                   \
105     (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
106 
107 
108 #define ngx_abort       abort
109 
110 
111 /* TODO: platform specific: array[NGX_INVALID_ARRAY_INDEX] must cause SIGSEGV */
112 #define NGX_INVALID_ARRAY_INDEX 0x80000000
113 
114 
115 /* TODO: auto_conf: ngx_inline   inline __inline __inline__ */
116 #ifndef ngx_inline
117 #define ngx_inline      inline
118 #endif
119 
120 #ifndef INADDR_NONE  /* Solaris */
121 #define INADDR_NONE  ((unsigned int) -1)
122 #endif
123 
124 #ifdef MAXHOSTNAMELEN
125 #define NGX_MAXHOSTNAMELEN  MAXHOSTNAMELEN
126 #else
127 #define NGX_MAXHOSTNAMELEN  256
128 #endif
129 
130 
131 #define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
132 #define NGX_MAX_INT32_VALUE   (uint32_t) 0x7fffffff
133 
134 
135 #if (NGX_COMPAT)
136 
137 #define NGX_COMPAT_BEGIN(slots)  uint64_t spare[slots];
138 #define NGX_COMPAT_END
139 
140 #else
141 
142 #define NGX_COMPAT_BEGIN(slots)
143 #define NGX_COMPAT_END
144 
145 #endif
146 
147 
148 #endif /* _NGX_CONFIG_H_INCLUDED_ */
149