summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES9
-rw-r--r--CHANGES.ru10
-rw-r--r--auto/install40
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/core/ngx_connection.h2
-rw-r--r--src/core/ngx_file.c10
-rw-r--r--src/core/ngx_file.h2
-rw-r--r--src/core/ngx_log.h2
-rw-r--r--src/core/ngx_string.c4
-rw-r--r--src/event/ngx_event.c28
-rw-r--r--src/event/ngx_event.h1
-rw-r--r--src/event/ngx_event_accept.c13
-rw-r--r--src/http/modules/ngx_http_range_filter.c2
-rw-r--r--src/http/modules/ngx_http_stub_status_module.c24
-rw-r--r--src/http/ngx_http_request.c2
-rw-r--r--src/os/unix/ngx_atomic.h116
16 files changed, 155 insertions, 112 deletions
diff --git a/CHANGES b/CHANGES
index 6c6c88fb1..d86c65e7f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,13 @@
+Changes with nginx 0.1.22 22 Feb 2005
+
+ *) Bugfix: the ngx_http_stub_status_module showed incorrect handled
+ connections statictics if the proxing or FastCGI server were used.
+
+ *) Bugfix: the installation pathes were incorrectly quoted on Linux and
+ Solaris; bug appeared in 0.1.21.
+
+
Changes with nginx 0.1.21 22 Feb 2005
*) Bugfix: the ngx_http_stub_status_module showed incorrect statictics
diff --git a/CHANGES.ru b/CHANGES.ru
index 9336bf0a1..60e697dbe 100644
--- a/CHANGES.ru
+++ b/CHANGES.ru
@@ -1,4 +1,14 @@
+Изменения в nginx 0.1.22 22.02.2005
+
+ *) Исправление: модуль ngx_http_stub_status_module показывал неверную
+ статистику для обработанных соединений, если использовалось
+ проксирование или FastCGI-сервер.
+
+ *) Исправление: на Linux и Solaris установочные пути были неверно
+ заключены в кавычки; ошибка появилась в 0.1.21.
+
+
Изменения в nginx 0.1.21 22.02.2005
*) Исправление: модуль ngx_http_stub_status_module показывал неверную
diff --git a/auto/install b/auto/install
index 558f64626..55f868a1d 100644
--- a/auto/install
+++ b/auto/install
@@ -5,40 +5,40 @@
cat << END >> $NGX_MAKEFILE
install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext}
- test -d "$NGX_PREFIX" || mkdir -p "$NGX_PREFIX"
+ test -d '$NGX_PREFIX' || mkdir -p '$NGX_PREFIX'
- test -d "`dirname \"$NGX_SBIN_PATH\"`" \
- || mkdir -p "`dirname \"$NGX_SBIN_PATH\"`"
- test ! -f "$NGX_SBIN_PATH" || mv "$NGX_SBIN_PATH" "$NGX_SBIN_PATH.old"
- cp $NGX_OBJS/nginx "$NGX_SBIN_PATH"
+ test -d '`dirname "$NGX_SBIN_PATH"`' \
+ || mkdir -p '`dirname "$NGX_SBIN_PATH"`'
+ test ! -f '$NGX_SBIN_PATH' || mv '$NGX_SBIN_PATH' '$NGX_SBIN_PATH.old'
+ cp $NGX_OBJS/nginx '$NGX_SBIN_PATH'
- test -d "`dirname \"$NGX_CONF_PATH\"`" \
- || mkdir -p "`dirname \"$NGX_CONF_PATH\"`"
+ test -d '`dirname "$NGX_CONF_PATH"`' \
+ || mkdir -p '`dirname "$NGX_CONF_PATH"`'
- cp conf/koi-win "`dirname \"$NGX_CONF_PATH\"`"
+ cp conf/koi-win '`dirname "$NGX_CONF_PATH"`'
- test -f "`dirname \"$NGX_CONF_PATH\"`/mime.types" || \
- cp conf/mime.types "`dirname \"$NGX_CONF_PATH\"`/mime.types"
- cp conf/mime.types "`dirname \"$NGX_CONF_PATH\"`/mime.types.default"
+ test -f '`dirname "$NGX_CONF_PATH"`/mime.types' || \
+ cp conf/mime.types '`dirname "$NGX_CONF_PATH"`/mime.types'
+ cp conf/mime.types '`dirname "$NGX_CONF_PATH"`/mime.types.default'
- test -f "$NGX_CONF_PATH" || cp conf/nginx.conf "$NGX_CONF_PATH"
- cp conf/nginx.conf "`dirname \"$NGX_CONF_PATH\"`/nginx.conf.default"
+ test -f '$NGX_CONF_PATH' || cp conf/nginx.conf '$NGX_CONF_PATH'
+ cp conf/nginx.conf '`dirname "$NGX_CONF_PATH"`/nginx.conf.default'
- test -d "`dirname \"$NGX_PID_PATH\"`" \
- || mkdir -p "`dirname \"$NGX_PID_PATH\"`"
+ test -d '`dirname "$NGX_PID_PATH"`' \
+ || mkdir -p '`dirname "$NGX_PID_PATH"`'
- test -d "`dirname \"$NGX_HTTP_LOG_PATH\"`" || \
- mkdir -p "`dirname \"$NGX_HTTP_LOG_PATH\"`"
+ test -d '`dirname "$NGX_HTTP_LOG_PATH"`' || \
+ mkdir -p '`dirname "$NGX_HTTP_LOG_PATH"`'
- test -d "$NGX_PREFIX/html" || cp -r html "$NGX_PREFIX"
+ test -d '$NGX_PREFIX/html' || cp -r html '$NGX_PREFIX'
END
if test -n "$NGX_ERROR_LOG_PATH"; then
cat << END >> $NGX_MAKEFILE
- test -d "`dirname \"$NGX_ERROR_LOG_PATH\"`" || \
- mkdir -p "`dirname \"$NGX_ERROR_LOG_PATH\"`"
+ test -d '`dirname "$NGX_ERROR_LOG_PATH"`' || \
+ mkdir -p '`dirname "$NGX_ERROR_LOG_PATH"`'
END
fi
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 5c4120786..073d68208 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.1.21"
+#define NGINX_VER "nginx/0.1.22"
#define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin"
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h
index 4d5d0c8d9..eed955a72 100644
--- a/src/core/ngx_connection.h
+++ b/src/core/ngx_connection.h
@@ -114,7 +114,7 @@ struct ngx_connection_s {
ngx_buf_t *buffer;
- ngx_atomic_int_t number;
+ ngx_atomic_uint_t number;
unsigned log_error:2; /* ngx_connection_log_error_e */
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index e06b8ca2d..514479cd2 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -8,8 +8,8 @@
#include <ngx_core.h>
-static ngx_atomic_int_t ngx_temp_number;
-static ngx_atomic_int_t ngx_random;
+static ngx_atomic_uint_t ngx_temp_number;
+static ngx_atomic_uint_t ngx_random;
ssize_t
@@ -38,8 +38,8 @@ ngx_int_t
ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
int persistent)
{
- ngx_err_t err;
- ngx_atomic_int_t n;
+ ngx_err_t err;
+ ngx_atomic_uint_t n;
file->name.len = path->name.len + 1 + path->len + NGX_ATOMIC_T_LEN;
@@ -176,7 +176,7 @@ ngx_init_temp_number()
}
-ngx_atomic_int_t
+ngx_atomic_uint_t
ngx_next_temp_number(ngx_uint_t collision)
{
if (collision) {
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index a76a64877..f7832d775 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -62,7 +62,7 @@ ngx_int_t ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot);
ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user);
void ngx_init_temp_number();
-ngx_atomic_int_t ngx_next_temp_number(ngx_uint_t collision);
+ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision);
char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 95dfe4154..48449a7fe 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -47,7 +47,7 @@ struct ngx_log_s {
ngx_uint_t log_level;
ngx_open_file_t *file;
- ngx_atomic_int_t connection;
+ ngx_atomic_uint_t connection;
ngx_log_handler_pt handler;
void *data;
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index ca9d669c5..fdb59fd9a 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -54,7 +54,7 @@ ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src)
* %[0][width|m][u][x|X]i ngx_int_t/ngx_uint_t
* %[0][width][u][x|X]D int32_t/uint32_t
* %[0][width][u][x|X]L int64_t/uint64_t
- * %[0][width|m][u][x|X]A ngx_atomic_int_t
+ * %[0][width|m][u][x|X]A ngx_atomic_int_t/ngx_atomic_uint_t
* %P ngx_pid_t
* %r rlim_t
* %p pointer
@@ -277,7 +277,7 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
- ui64 = (uint64_t) va_arg(args, ngx_atomic_int_t);
+ ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c
index 780dbeba5..38efca0b8 100644
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -34,27 +34,29 @@ static char *ngx_event_init_conf(ngx_cycle_t *cycle, void *conf);
static char *ngx_accept_mutex_check(ngx_conf_t *cf, void *post, void *data);
-static ngx_uint_t ngx_event_max_module;
+static ngx_uint_t ngx_event_max_module;
-ngx_uint_t ngx_event_flags;
-ngx_event_actions_t ngx_event_actions;
+ngx_uint_t ngx_event_flags;
+ngx_event_actions_t ngx_event_actions;
-ngx_atomic_t connection_counter;
+ngx_atomic_t connection_counter;
ngx_atomic_t *ngx_connection_counter = &connection_counter;
ngx_atomic_t *ngx_accept_mutex_ptr;
ngx_atomic_t *ngx_accept_mutex;
-ngx_uint_t ngx_accept_mutex_held;
-ngx_msec_t ngx_accept_mutex_delay;
-ngx_int_t ngx_accept_disabled;
+ngx_uint_t ngx_accept_mutex_held;
+ngx_msec_t ngx_accept_mutex_delay;
+ngx_int_t ngx_accept_disabled;
#if (NGX_STAT_STUB)
ngx_atomic_t ngx_stat_accepted0;
ngx_atomic_t *ngx_stat_accepted = &ngx_stat_accepted0;
+ngx_atomic_t ngx_stat_handled0;
+ngx_atomic_t *ngx_stat_handled = &ngx_stat_handled0;
ngx_atomic_t ngx_stat_requests0;
ngx_atomic_t *ngx_stat_requests = &ngx_stat_requests0;
ngx_atomic_t ngx_stat_active0;
@@ -62,7 +64,7 @@ ngx_atomic_t *ngx_stat_active = &ngx_stat_active0;
ngx_atomic_t ngx_stat_reading0;
ngx_atomic_t *ngx_stat_reading = &ngx_stat_reading0;
ngx_atomic_t ngx_stat_writing0;
-ngx_atomic_t *ngx_stat_writing = &ngx_stat_reading0;
+ngx_atomic_t *ngx_stat_writing = &ngx_stat_writing0;
#endif
@@ -209,6 +211,7 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle)
#if (NGX_STAT_STUB)
size += 128 /* ngx_stat_accepted */
+ + 128 /* ngx_stat_handled */
+ 128 /* ngx_stat_requests */
+ 128 /* ngx_stat_active */
+ 128 /* ngx_stat_reading */
@@ -226,10 +229,11 @@ static ngx_int_t ngx_event_module_init(ngx_cycle_t *cycle)
#if (NGX_STAT_STUB)
ngx_stat_accepted = (ngx_atomic_t *) (shared + 2 * 128);
- ngx_stat_requests = (ngx_atomic_t *) (shared + 3 * 128);
- ngx_stat_active = (ngx_atomic_t *) (shared + 4 * 128);
- ngx_stat_reading = (ngx_atomic_t *) (shared + 5 * 128);
- ngx_stat_writing = (ngx_atomic_t *) (shared + 6 * 128);
+ ngx_stat_handled = (ngx_atomic_t *) (shared + 3 * 128);
+ ngx_stat_requests = (ngx_atomic_t *) (shared + 4 * 128);
+ ngx_stat_active = (ngx_atomic_t *) (shared + 5 * 128);
+ ngx_stat_reading = (ngx_atomic_t *) (shared + 6 * 128);
+ ngx_stat_writing = (ngx_atomic_t *) (shared + 7 * 128);
#endif
diff --git a/src/event/ngx_event.h b/src/event/ngx_event.h
index d156a6393..6dfd70986 100644
--- a/src/event/ngx_event.h
+++ b/src/event/ngx_event.h
@@ -442,6 +442,7 @@ extern ngx_int_t ngx_accept_disabled;
#if (NGX_STAT_STUB)
extern ngx_atomic_t *ngx_stat_accepted;
+extern ngx_atomic_t *ngx_stat_handled;
extern ngx_atomic_t *ngx_stat_requests;
extern ngx_atomic_t *ngx_stat_active;
extern ngx_atomic_t *ngx_stat_reading;
diff --git a/src/event/ngx_event_accept.c b/src/event/ngx_event_accept.c
index fb2d98473..f30e1fcc3 100644
--- a/src/event/ngx_event_accept.c
+++ b/src/event/ngx_event_accept.c
@@ -118,6 +118,7 @@ ngx_event_accept(ngx_event_t *ev)
#if (NGX_STAT_STUB)
ngx_atomic_inc(ngx_stat_accepted);
+ ngx_atomic_inc(ngx_stat_active);
#endif
ngx_accept_disabled = (ngx_uint_t) s + NGX_ACCEPT_THRESHOLD
@@ -138,10 +139,6 @@ ngx_event_accept(ngx_event_t *ev)
return;
}
-#if (NGX_STAT_STUB)
- ngx_atomic_inc(ngx_stat_active);
-#endif
-
/* set a blocking mode for aio and non-blocking mode for others */
if (ngx_inherited_nonblocking) {
@@ -263,6 +260,10 @@ ngx_event_accept(ngx_event_t *ev)
c->number = ngx_atomic_inc(ngx_connection_counter);
+#if (NGX_STAT_STUB)
+ ngx_atomic_inc(ngx_stat_handled);
+#endif
+
#if (NGX_THREADS)
rev->lock = &c->lock;
wev->lock = &c->lock;
@@ -452,6 +453,10 @@ ngx_close_accepted_socket(ngx_socket_t s, ngx_log_t *log)
ngx_log_error(NGX_LOG_ALERT, log, ngx_socket_errno,
ngx_close_socket_n " failed");
}
+
+#if (NGX_STAT_STUB)
+ ngx_atomic_dec(ngx_stat_active);
+#endif
}
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index 1eb4cc617..0049af6cb 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -113,7 +113,7 @@ ngx_http_range_header_filter(ngx_http_request_t *r)
off_t start, end;
ngx_int_t rc;
ngx_uint_t suffix, i;
- ngx_atomic_int_t boundary;
+ ngx_atomic_uint_t boundary;
ngx_table_elt_t *content_range;
ngx_http_range_t *range;
ngx_http_range_filter_ctx_t *ctx;
diff --git a/src/http/modules/ngx_http_stub_status_module.c b/src/http/modules/ngx_http_stub_status_module.c
index 834beaa92..7eeef5986 100644
--- a/src/http/modules/ngx_http_stub_status_module.c
+++ b/src/http/modules/ngx_http_stub_status_module.c
@@ -47,11 +47,11 @@ ngx_module_t ngx_http_stub_status_module = {
static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
{
- size_t size;
- ngx_int_t rc;
- uint32_t ap, hn, ac, rq, rd, wr;
- ngx_buf_t *b;
- ngx_chain_t out;
+ size_t size;
+ ngx_int_t rc;
+ ngx_buf_t *b;
+ ngx_chain_t out;
+ ngx_atomic_int_t ap, hn, ac, rq, rd, wr;
if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
return NGX_HTTP_NOT_ALLOWED;
@@ -83,10 +83,10 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
}
}
- size = sizeof("Active connections: \n") + NGX_INT32_LEN
+ size = sizeof("Active connections: \n") + NGX_ATOMIC_T_LEN
+ sizeof("server accepts handled requests\n") - 1
- + 6 + 3 * NGX_INT32_LEN
- + sizeof("Reading: Writing: Waiting: \n") + 3 * NGX_INT32_LEN;
+ + 6 + 3 * NGX_ATOMIC_T_LEN
+ + sizeof("Reading: Writing: Waiting: \n") + 3 * NGX_ATOMIC_T_LEN;
if (!(b = ngx_create_temp_buf(r->pool, size))) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -96,20 +96,20 @@ static ngx_int_t ngx_http_status_handler(ngx_http_request_t *r)
out.next = NULL;
ap = *ngx_stat_accepted;
- hn = *ngx_connection_counter;
+ hn = *ngx_stat_handled;
ac = *ngx_stat_active;
rq = *ngx_stat_requests;
rd = *ngx_stat_reading;
wr = *ngx_stat_writing;
- b->last = ngx_sprintf(b->last, "Active connections: %D \n", ac);
+ b->last = ngx_sprintf(b->last, "Active connections: %A \n", ac);
b->last = ngx_cpymem(b->last, "server accepts handled requests\n",
sizeof("server accepts handled requests\n") - 1);
- b->last = ngx_sprintf(b->last, " %D %D %D \n", ap, hn, rq);
+ b->last = ngx_sprintf(b->last, " %A %A %A \n", ap, hn, rq);
- b->last = ngx_sprintf(b->last, "Reading: %D Writing: %D Waiting: %d \n",
+ b->last = ngx_sprintf(b->last, "Reading: %A Writing: %A Waiting: %A \n",
rd, wr, ac - (rd + wr));
r->headers_out.status = NGX_HTTP_OK;
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index f4908476c..b7e53ff2a 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -148,7 +148,7 @@ void ngx_http_init_connection(ngx_connection_t *c)
ngx_mutex_unlock(ngx_posted_events_mutex);
#if (NGX_STAT_STUB)
- ngx_atomic_inc(ngx_stat_reading);
+ ngx_atomic_inc(ngx_stat_reading);
#endif
return;
}
diff --git a/src/os/unix/ngx_atomic.h b/src/os/unix/ngx_atomic.h
index c31396468..d882a0205 100644
--- a/src/os/unix/ngx_atomic.h
+++ b/src/os/unix/ngx_atomic.h
@@ -16,8 +16,9 @@
#define NGX_HAVE_ATOMIC_OPS 1
-typedef uint32_t ngx_atomic_int_t;
-typedef volatile ngx_atomic_int_t ngx_atomic_t;
+typedef int32_t ngx_atomic_int_t;
+typedef uint32_t ngx_atomic_uint_t;
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1
@@ -31,12 +32,18 @@ typedef volatile ngx_atomic_int_t ngx_atomic_t;
* the "=q" is any of the %eax, %ebx, %ecx, or %edx registers.
* the '"0" (1)' parameter preloads 1 into %0.
* the "cc" means that flags were changed.
+ *
+ * "xadd r, [m]":
+ *
+ * temp = [m];
+ * [m] += r;
+ * r = temp;
*/
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_inc(ngx_atomic_t *value)
{
- ngx_atomic_int_t old;
+ ngx_atomic_uint_t old;
__asm__ volatile (
@@ -50,10 +57,10 @@ ngx_atomic_inc(ngx_atomic_t *value)
}
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_dec(ngx_atomic_t *value)
{
- ngx_atomic_int_t old;
+ ngx_atomic_uint_t old;
__asm__ volatile (
@@ -74,20 +81,20 @@ ngx_atomic_dec(ngx_atomic_t *value)
*
* "cmpxchg r, [m]":
*
- * if (eax == [m]) {
- * zf = 1;
- * [m] = r;
- * } else {
- * zf = 0;
- * eax = [m];
- * }
+ * if (eax == [m]) {
+ * zf = 1;
+ * [m] = r;
+ * } else {
+ * zf = 0;
+ * eax = [m];
+ * }
*/
-static ngx_inline ngx_atomic_int_t
-ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
- ngx_atomic_int_t set)
+static ngx_inline ngx_atomic_uint_t
+ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
+ ngx_atomic_uint_t set)
{
- ngx_atomic_int_t res;
+ ngx_atomic_uint_t res;
__asm__ volatile (
@@ -107,7 +114,8 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
#define NGX_HAVE_ATOMIC_OPS 1
typedef int64_t ngx_atomic_int_t;
-typedef volatile ngx_atomic_int_t ngx_atomic_t;
+typedef uint64_t ngx_atomic_uint_t;
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1
@@ -118,10 +126,10 @@ typedef volatile ngx_atomic_int_t ngx_atomic_t;
#endif
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_inc(ngx_atomic_t *value)
{
- ngx_atomic_int_t old;
+ ngx_atomic_uint_t old;
__asm__ volatile (
@@ -137,10 +145,10 @@ ngx_atomic_inc(ngx_atomic_t *value)
/* the '"0" (-1LL)' parameter preloads -1 into the 64-bit %0 register */
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_dec(ngx_atomic_t *value)
{
- ngx_atomic_int_t old;
+ ngx_atomic_uint_t old;
__asm__ volatile (
@@ -156,11 +164,11 @@ ngx_atomic_dec(ngx_atomic_t *value)
/* the "=a" and "a" are the %rax register. */
-static ngx_inline ngx_atomic_int_t
-ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
- ngx_atomic_int_t set)
+static ngx_inline ngx_atomic_uint_t
+ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
+ ngx_atomic_uint_t set)
{
- ngx_atomic_int_t res;
+ ngx_atomic_uint_t res;
__asm__ volatile (
@@ -180,16 +188,18 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
#define NGX_HAVE_ATOMIC_OPS 1
#if (NGX_PTR_SIZE == 8)
-typedef uint64_t ngx_atomic_int_t;
+typedef int64_t ngx_atomic_int_t;
+typedef uint64_t ngx_atomic_uint_t;
#define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1
#define NGX_CASXA "casxa"
#else
-typedef uint32_t ngx_atomic_int_t;
+typedef int32_t ngx_atomic_int_t;
+typedef uint32_t ngx_atomic_uint_t;
#define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1
#define NGX_CASXA "casa"
#endif
-typedef volatile ngx_atomic_int_t ngx_atomic_t;
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
/*
@@ -207,10 +217,10 @@ typedef volatile ngx_atomic_int_t ngx_atomic_t;
* so "r0 == r2" means that the operation was successfull.
*/
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_inc(ngx_atomic_t *value)
{
- ngx_atomic_int_t old, new, res;
+ ngx_atomic_uint_t old, new, res;
old = *value;
@@ -234,10 +244,10 @@ ngx_atomic_inc(ngx_atomic_t *value)
}
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_dec(ngx_atomic_t *value)
{
- ngx_atomic_int_t old, new, res;
+ ngx_atomic_uint_t old, new, res;
old = *value;
@@ -261,8 +271,9 @@ ngx_atomic_dec(ngx_atomic_t *value)
}
-static ngx_inline ngx_atomic_int_t
-ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old, ngx_atomic_int_t set)
+static ngx_inline ngx_atomic_uint_t
+ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
+ ngx_atomic_uint_t set)
{
__asm__ volatile (
@@ -279,14 +290,16 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old, ngx_atomic_int_t se
#define NGX_HAVE_ATOMIC_OPS 1
#if (NGX_PTR_SIZE == 8)
-typedef uint64_t ngx_atomic_int_t;
+typedef int64_t ngx_atomic_int_t;
+typedef uint64_t ngx_atomic_uint_t;
#define NGX_ATOMIC_T_LEN sizeof("-9223372036854775808") - 1
#else
+typedef int32_t ngx_atomic_int_t;
+typedef uint32_t ngx_atomic_uint_t;
#define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1
-typedef uint32_t ngx_atomic_int_t;
#endif
-typedef volatile ngx_atomic_int_t ngx_atomic_t;
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
/*
@@ -301,10 +314,10 @@ typedef volatile ngx_atomic_int_t ngx_atomic_t;
* the nearest forward label "1".
*/
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_inc(ngx_atomic_t *value)
{
- ngx_atomic_int_t res;
+ ngx_atomic_uint_t res;
__asm__ volatile (
@@ -321,10 +334,10 @@ ngx_atomic_inc(ngx_atomic_t *value)
}
-static ngx_inline ngx_atomic_int_t
+static ngx_inline ngx_atomic_uint_t
ngx_atomic_dec(ngx_atomic_t *value)
{
- ngx_atomic_int_t res;
+ ngx_atomic_uint_t res;
__asm__ volatile (
@@ -341,11 +354,11 @@ ngx_atomic_dec(ngx_atomic_t *value)
}
-static ngx_inline ngx_atomic_int_t
-ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
- ngx_atomic_int_t set)
+static ngx_inline ngx_atomic_uint_t
+ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
+ ngx_atomic_uint_t set)
{
- ngx_atomic_int_t res, temp;
+ ngx_atomic_uint_t res, temp;
__asm__ volatile (
@@ -372,15 +385,16 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
#define NGX_HAVE_ATOMIC_OPS 0
-typedef uint32_t ngx_atomic_int_t;
-typedef volatile ngx_atomic_int_t ngx_atomic_t;
+typedef int32_t ngx_atomic_int_t;
+typedef uint32_t ngx_atomic_uint_t;
+typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#define ngx_atomic_inc(x) ++(*(x))
#define ngx_atomic_dec(x) --(*(x))
-static ngx_inline ngx_atomic_int_t
-ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_int_t old,
- ngx_atomic_int_t set)
+static ngx_inline ngx_atomic_uint_t
+ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
+ ngx_atomic_uint_t set)
{
*lock = set;
return 1;