comparison src/os/unix/ngx_atomic.h @ 542:4c5d2c627a6c NGINX_0_8_17

nginx 0.8.17 *) Security: now "/../" are disabled in "Destination" request header line. *) Change: now $host variable value is always low case. *) Feature: the $ssl_session_id variable. *) Bugfix: socket leak; the bug had appeared in 0.8.11.
author Igor Sysoev <http://sysoev.ru>
date Mon, 28 Sep 2009 00:00:00 +0400
parents 34fb3a573548
children 5c576ea5dbd9
comparison
equal deleted inserted replaced
541:b8ac674b0ec9 542:4c5d2c627a6c
29 29
30 #if (NGX_PTR_SIZE == 8) 30 #if (NGX_PTR_SIZE == 8)
31 31
32 typedef int64_t ngx_atomic_int_t; 32 typedef int64_t ngx_atomic_int_t;
33 typedef uint64_t ngx_atomic_uint_t; 33 typedef uint64_t ngx_atomic_uint_t;
34 #define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1 34 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
35 35
36 #define ngx_atomic_cmp_set(lock, old, new) \ 36 #define ngx_atomic_cmp_set(lock, old, new) \
37 OSAtomicCompareAndSwap64Barrier(old, new, (int64_t *) lock) 37 OSAtomicCompareAndSwap64Barrier(old, new, (int64_t *) lock)
38 38
39 #define ngx_atomic_fetch_add(value, add) \ 39 #define ngx_atomic_fetch_add(value, add) \
41 41
42 #else 42 #else
43 43
44 typedef int32_t ngx_atomic_int_t; 44 typedef int32_t ngx_atomic_int_t;
45 typedef uint32_t ngx_atomic_uint_t; 45 typedef uint32_t ngx_atomic_uint_t;
46 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 46 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
47 47
48 #define ngx_atomic_cmp_set(lock, old, new) \ 48 #define ngx_atomic_cmp_set(lock, old, new) \
49 OSAtomicCompareAndSwap32Barrier(old, new, (int32_t *) lock) 49 OSAtomicCompareAndSwap32Barrier(old, new, (int32_t *) lock)
50 50
51 #define ngx_atomic_fetch_add(value, add) \ 51 #define ngx_atomic_fetch_add(value, add) \
66 #if ( __i386__ || __i386 ) 66 #if ( __i386__ || __i386 )
67 67
68 typedef int32_t ngx_atomic_int_t; 68 typedef int32_t ngx_atomic_int_t;
69 typedef uint32_t ngx_atomic_uint_t; 69 typedef uint32_t ngx_atomic_uint_t;
70 typedef volatile ngx_atomic_uint_t ngx_atomic_t; 70 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
71 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 71 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
72 72
73 73
74 #if ( __SUNPRO_C ) 74 #if ( __SUNPRO_C )
75 75
76 #define NGX_HAVE_ATOMIC_OPS 1 76 #define NGX_HAVE_ATOMIC_OPS 1
107 #elif ( __amd64__ || __amd64 ) 107 #elif ( __amd64__ || __amd64 )
108 108
109 typedef int64_t ngx_atomic_int_t; 109 typedef int64_t ngx_atomic_int_t;
110 typedef uint64_t ngx_atomic_uint_t; 110 typedef uint64_t ngx_atomic_uint_t;
111 typedef volatile ngx_atomic_uint_t ngx_atomic_t; 111 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
112 #define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1 112 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
113 113
114 114
115 #if ( __SUNPRO_C ) 115 #if ( __SUNPRO_C )
116 116
117 #define NGX_HAVE_ATOMIC_OPS 1 117 #define NGX_HAVE_ATOMIC_OPS 1
149 149
150 #if (NGX_PTR_SIZE == 8) 150 #if (NGX_PTR_SIZE == 8)
151 151
152 typedef int64_t ngx_atomic_int_t; 152 typedef int64_t ngx_atomic_int_t;
153 typedef uint64_t ngx_atomic_uint_t; 153 typedef uint64_t ngx_atomic_uint_t;
154 #define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1 154 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
155 155
156 #else 156 #else
157 157
158 typedef int32_t ngx_atomic_int_t; 158 typedef int32_t ngx_atomic_int_t;
159 typedef uint32_t ngx_atomic_uint_t; 159 typedef uint32_t ngx_atomic_uint_t;
160 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 160 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
161 161
162 #endif 162 #endif
163 163
164 typedef volatile ngx_atomic_uint_t ngx_atomic_t; 164 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
165 165
186 186
187 #if (NGX_PTR_SIZE == 8) 187 #if (NGX_PTR_SIZE == 8)
188 188
189 typedef int64_t ngx_atomic_int_t; 189 typedef int64_t ngx_atomic_int_t;
190 typedef uint64_t ngx_atomic_uint_t; 190 typedef uint64_t ngx_atomic_uint_t;
191 #define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1 191 #define NGX_ATOMIC_T_LEN (sizeof("-9223372036854775808") - 1)
192 192
193 #else 193 #else
194 194
195 typedef int32_t ngx_atomic_int_t; 195 typedef int32_t ngx_atomic_int_t;
196 typedef uint32_t ngx_atomic_uint_t; 196 typedef uint32_t ngx_atomic_uint_t;
197 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 197 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
198 198
199 #endif 199 #endif
200 200
201 typedef volatile ngx_atomic_uint_t ngx_atomic_t; 201 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
202 202
214 #define NGX_HAVE_ATOMIC_OPS 0 214 #define NGX_HAVE_ATOMIC_OPS 0
215 215
216 typedef int32_t ngx_atomic_int_t; 216 typedef int32_t ngx_atomic_int_t;
217 typedef uint32_t ngx_atomic_uint_t; 217 typedef uint32_t ngx_atomic_uint_t;
218 typedef volatile ngx_atomic_uint_t ngx_atomic_t; 218 typedef volatile ngx_atomic_uint_t ngx_atomic_t;
219 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 219 #define NGX_ATOMIC_T_LEN (sizeof("-2147483648") - 1)
220 220
221 221
222 static ngx_inline ngx_atomic_uint_t 222 static ngx_inline ngx_atomic_uint_t
223 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, 223 ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
224 ngx_atomic_uint_t set) 224 ngx_atomic_uint_t set)