diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-07-22 08:47:45 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-07-22 08:47:45 +0000 |
| commit | 64bb1e34d24f805a278da05e55efd449be76e57f (patch) | |
| tree | bf4555e728d672cf86c58f163eb7e1e8f3b0bdb1 /src | |
| parent | fbd3b2d727af9cc308d0a0c82812d5181f9a477e (diff) | |
| download | nginx-64bb1e34d24f805a278da05e55efd449be76e57f.tar.gz nginx-64bb1e34d24f805a278da05e55efd449be76e57f.tar.bz2 | |
r1306, r1307, r1308, r1309, r1310, r1311, r1322, r1325 merge:
Sun Studio related fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/ngx_string.c | 28 | ||||
| -rw-r--r-- | src/core/ngx_string.h | 19 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_charset_filter_module.c | 23 | ||||
| -rw-r--r-- | src/http/modules/ngx_http_ssl_module.c | 15 | ||||
| -rw-r--r-- | src/http/ngx_http_variables.c | 2 | ||||
| -rw-r--r-- | src/http/ngx_http_variables.h | 10 | ||||
| -rw-r--r-- | src/os/unix/ngx_atomic.h | 20 | ||||
| -rw-r--r-- | src/os/unix/ngx_sunpro_amd64.il | 7 | ||||
| -rw-r--r-- | src/os/unix/ngx_sunpro_x86.il | 7 |
9 files changed, 87 insertions, 44 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 29dc39f5a..6a927b03b 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -105,21 +105,21 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { - u_char *p, zero, *last, temp[NGX_INT64_LEN + 1]; + u_char *p, zero, *last, temp[NGX_INT64_LEN + 1]; /* * really we need temp[NGX_INT64_LEN] only, * but icc issues the warning */ - int d; - size_t len; - uint32_t ui32; - int64_t i64; - uint64_t ui64; - ngx_msec_t ms; - ngx_str_t *s; - ngx_uint_t width, sign, hexadecimal, max_width; - static u_char hex[] = "0123456789abcdef"; - static u_char HEX[] = "0123456789ABCDEF"; + int d; + size_t len; + uint32_t ui32; + int64_t i64; + uint64_t ui64; + ngx_msec_t ms; + ngx_uint_t width, sign, hexadecimal, max_width; + ngx_variable_value_t *v; + static u_char hex[] = "0123456789abcdef"; + static u_char HEX[] = "0123456789ABCDEF"; if (max == 0) { return buf; @@ -188,12 +188,12 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) switch (*fmt) { case 'V': - s = va_arg(args, ngx_str_t *); + v = va_arg(args, ngx_variable_value_t *); - len = s->len & 0xffff; + len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); - buf = ngx_cpymem(buf, s->data, len); + buf = ngx_cpymem(buf, v->data, len); fmt++; continue; diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index 6b432d1f2..9e0b06394 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -13,17 +13,28 @@ typedef struct { - size_t len; - u_char *data; + size_t len; + u_char *data; } ngx_str_t; typedef struct { - ngx_str_t key; - ngx_str_t value; + ngx_str_t key; + ngx_str_t value; } ngx_keyval_t; +typedef struct { + unsigned len:29; + + unsigned valid:1; + unsigned no_cachable:1; + unsigned not_found:1; + + u_char *data; +} ngx_variable_value_t; + + #define ngx_string(str) { sizeof(str) - 1, (u_char *) str } #define ngx_null_string { 0, NULL } diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c index 0139cc671..98919ae2f 100644 --- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c @@ -187,7 +187,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) { u_char *ct; ngx_int_t charset, source_charset; - ngx_str_t *mc, *from, *to; + ngx_str_t *mc, *from, *to, s; ngx_uint_t n; ngx_http_charset_t *charsets; ngx_http_charset_ctx_t *ctx; @@ -256,8 +256,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) return NGX_ERROR; } - charset = ngx_http_charset_get_charset(charsets, n, - (ngx_str_t *) vv); + s.len = vv->len; + s.data = vv->data; + + charset = ngx_http_charset_get_charset(charsets, n, &s); } } @@ -303,8 +305,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r) return NGX_ERROR; } - source_charset = ngx_http_charset_get_charset(charsets, n, - (ngx_str_t *) vv); + s.len = vv->len; + s.data = vv->data; + + source_charset = ngx_http_charset_get_charset(charsets, n, &s); } if (charset != NGX_HTTP_NO_CHARSET) { @@ -373,17 +377,16 @@ static ngx_int_t ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n, ngx_str_t *charset) { - size_t len; ngx_uint_t i; - len = charset->len & 0xffff; - for (i = 0; i < n; i++) { - if (charsets[i].name.len != len) { + if (charsets[i].name.len != charset->len) { continue; } - if (ngx_strncasecmp(charsets[i].name.data, charset->data, len) == 0) { + if (ngx_strncasecmp(charsets[i].name.data, charset->data, charset->len) + == 0) + { return i; } } diff --git a/src/http/modules/ngx_http_ssl_module.c b/src/http/modules/ngx_http_ssl_module.c index 7376d1028..1ffa54fb5 100644 --- a/src/http/modules/ngx_http_ssl_module.c +++ b/src/http/modules/ngx_http_ssl_module.c @@ -197,11 +197,14 @@ ngx_http_ssl_static_variable(ngx_http_request_t *r, { ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data; - size_t len; + size_t len; + ngx_str_t s; if (r->connection->ssl) { - (void) handler(r->connection, NULL, (ngx_str_t *) v); + (void) handler(r->connection, NULL, &s); + + v->data = s.data; for (len = 0; v->data[len]; len++) { /* void */ } @@ -225,11 +228,17 @@ ngx_http_ssl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, { ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data; + ngx_str_t s; + if (r->connection->ssl) { - if (handler(r->connection, r->pool, (ngx_str_t *) v) != NGX_OK) { + + if (handler(r->connection, r->pool, &s) != NGX_OK) { return NGX_ERROR; } + v->len = s.len; + v->data = s.data; + if (v->len) { v->valid = 1; v->no_cachable = 0; diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index 0bd6b7ec6..6316b3d58 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -501,7 +501,7 @@ ngx_http_variable_request_set_size(ngx_http_request_t *r, ssize_t s, *sp; ngx_str_t val; - val.len = v->len & 0xffff; + val.len = v->len; val.data = v->data; s = ngx_parse_size(&val); diff --git a/src/http/ngx_http_variables.h b/src/http/ngx_http_variables.h index df487e48e..1dc982844 100644 --- a/src/http/ngx_http_variables.h +++ b/src/http/ngx_http_variables.h @@ -14,15 +14,7 @@ #include <ngx_http.h> -typedef struct { - unsigned len:29; - - unsigned valid:1; - unsigned no_cachable:1; - unsigned not_found:1; - - u_char *data; -} ngx_http_variable_value_t; +typedef ngx_variable_value_t ngx_http_variable_value_t; #define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, (u_char *) v } diff --git a/src/os/unix/ngx_atomic.h b/src/os/unix/ngx_atomic.h index c0734e12e..22b8b0144 100644 --- a/src/os/unix/ngx_atomic.h +++ b/src/os/unix/ngx_atomic.h @@ -87,10 +87,17 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, ngx_atomic_int_t ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add); +/* + * Sun Studio 12 exits with segmentation fault on '__asm ("pause")', + * so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_x86.il + */ + +void +ngx_cpu_pause(void); + /* the code in src/os/unix/ngx_sunpro_x86.il */ #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") -#define ngx_cpu_pause() __asm ("pause") #else /* ( __GNUC__ || __INTEL_COMPILER ) */ @@ -121,10 +128,17 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, ngx_atomic_int_t ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add); +/* + * Sun Studio 12 exits with segmentation fault on '__asm ("pause")', + * so ngx_cpu_pause is declared in src/os/unix/ngx_sunpro_amd64.il + */ + +void +ngx_cpu_pause(void); + /* the code in src/os/unix/ngx_sunpro_amd64.il */ #define ngx_memory_barrier() __asm (".volatile"); __asm (".nonvolatile") -#define ngx_cpu_pause() __asm ("pause") #else /* ( __GNUC__ || __INTEL_COMPILER ) */ @@ -136,7 +150,7 @@ ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add); #endif -#elif ( __sparc__ || __sparcv9 ) +#elif ( __sparc__ || __sparc || __sparcv9 ) #if (NGX_PTR_SIZE == 8) diff --git a/src/os/unix/ngx_sunpro_amd64.il b/src/os/unix/ngx_sunpro_amd64.il index 0cd94b023..c26e6f717 100644 --- a/src/os/unix/ngx_sunpro_amd64.il +++ b/src/os/unix/ngx_sunpro_amd64.il @@ -28,3 +28,10 @@ lock xaddq %rax, (%rdi) .end + + +/ ngx_cpu_pause() + + .inline ngx_cpu_pause,0 + pause + .end diff --git a/src/os/unix/ngx_sunpro_x86.il b/src/os/unix/ngx_sunpro_x86.il index a16568ac8..b82a2267b 100644 --- a/src/os/unix/ngx_sunpro_x86.il +++ b/src/os/unix/ngx_sunpro_x86.il @@ -29,3 +29,10 @@ lock xaddl %eax, (%ecx) .end + + +/ ngx_cpu_pause() + + .inline ngx_cpu_pause,0 + pause + .end |
