Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-09-14 19:55:24 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-09-14 19:55:24 +0400
commite2ff3ea920ba6bc3690a333abdaa2e40656f933a (patch)
tree5e9d8e784f041e7fb29cda6c87b7119ccd6d2817 /src
parent562626ae6cda8c90121bec3362232e87899d6ce6 (diff)
nginx-0.0.10-2004-09-14-19:55:24 import
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_inet.c55
-rw-r--r--src/event/modules/ngx_kqueue_module.c10
-rw-r--r--src/event/ngx_event_accept.c2
-rw-r--r--src/http/ngx_http_core_module.c10
-rw-r--r--src/os/unix/ngx_atomic.h51
5 files changed, 120 insertions, 8 deletions
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 910846f02..94d0c72e5 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -210,3 +210,58 @@ ngx_int_t ngx_ptocidr(ngx_str_t *text, void *cidr)
return NGX_OK;
}
+
+
+#if 0
+
+ngx_int_t ngx_inet_addr_port(ngx_conf_t *cf, ngx_command_t *cmd,
+ ngx_str_t *addr_port)
+{
+ u_char *host;
+ ngx_int_t port;
+ ngx_uint_t p;
+ struct hostent *h;
+
+ for (p = 0; p < addr_port->len; p++) {
+ if (addr_port->data[p] == ':') {
+ break;
+ }
+ }
+
+ in_addr->host.len = p;
+ if (!(in_addr->host.data = ngx_palloc(pool, p + 1))) {
+ return NGX_ERROR;
+ }
+
+ ngx_cpystrn(in_addr->host.data, addr_port->data, p + 1);
+
+ if (p == addr_port->len) {
+ p = 0;
+ }
+
+ port = ngx_atoi(&addr[p], args[1].len - p);
+ if (port == NGX_ERROR && p == 0) {
+
+ /* default port */
+ iap->port = 0;
+
+ } else if ((port == NGX_ERROR && p != 0) /* "listen host:NONNUMBER" */
+ || (port < 1 || port > 65536)) { /* "listen 99999" */
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid port \"%s\" in \"%s\" directive, "
+ "it must be a number between 1 and 65535",
+ &addr[p], cmd->name.data);
+
+ return NGX_CONF_ERROR;
+
+ } else if (p == 0) {
+ ls->addr = INADDR_ANY;
+ ls->port = (in_port_t) port;
+ return NGX_CONF_OK;
+ }
+
+ return NGX_OK;
+}
+
+#endif
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 6116de0ad..a1d6f5907 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -707,11 +707,11 @@ static ngx_int_t ngx_kqueue_process_events(ngx_cycle_t *cycle)
static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try)
{
- int n;
- ngx_int_t rc;
- ngx_err_t err;
- struct timespec ts;
- struct kevent *changes;
+ int n;
+ ngx_int_t rc;
+ ngx_err_t err;
+ struct timespec ts;
+ struct kevent *changes;
if (ngx_mutex_lock(kevent_mutex) == NGX_ERROR) {
return NGX_ERROR;
diff --git a/src/event/ngx_event_accept.c b/src/event/ngx_event_accept.c
index 10f24a6ad..a02318d2f 100644
--- a/src/event/ngx_event_accept.c
+++ b/src/event/ngx_event_accept.c
@@ -95,12 +95,14 @@ void ngx_event_accept(ngx_event_t *ev)
err = ngx_socket_errno;
if (err == NGX_EAGAIN) {
+#if 0
if (!(ngx_event_flags & NGX_USE_RTSIG_EVENT))
{
ngx_log_error(NGX_LOG_NOTICE, log, err,
"EAGAIN after %d accepted connection(s)",
accepted);
}
+#endif
ngx_destroy_pool(pool);
return;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 6c4f819b9..f00ae658c 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1479,10 +1479,14 @@ static char *ngx_set_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_str_t *args;
ngx_http_listen_t *ls;
- /* TODO: check duplicate 'listen' directives,
- add resolved name to server names ??? */
+ /*
+ * TODO: check duplicate 'listen' directives,
+ * add resolved name to server names ???
+ */
- ngx_test_null(ls, ngx_push_array(&scf->listen), NGX_CONF_ERROR);
+ if (!(ls = ngx_array_push(&scf->listen))) {
+ return NGX_CONF_ERROR;
+ }
/* AF_INET only */
diff --git a/src/os/unix/ngx_atomic.h b/src/os/unix/ngx_atomic.h
index 18d5edac5..552edd5e8 100644
--- a/src/os/unix/ngx_atomic.h
+++ b/src/os/unix/ngx_atomic.h
@@ -68,6 +68,57 @@ static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
}
+#elif ( __sparc__ )
+
+typedef volatile uint32_t ngx_atomic_t;
+
+
+static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value)
+{
+ uint32_t old, new, res;
+
+ old = *value;
+
+ for ( ;; ) {
+
+ new = old + 1;
+ res = new;
+
+ __asm__ volatile (
+
+ "casa [%1]ASI_P, %2, %0"
+
+ : "+r" (res) : "r" (value), "r" (old));
+
+ if (res == old) {
+ return new;
+ }
+
+ old = res;
+ }
+}
+
+
+/* STUB */
+#define ngx_atomic_dec(x) (*(x))--;
+/**/
+
+
+static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock,
+ ngx_atomic_t old,
+ ngx_atomic_t set)
+{
+ uint32_t res = (u_int32_t) set;
+
+ __asm__ volatile (
+
+ "casa [%1]ASI_P, %2, %0"
+
+ : "+r" (res) : "r" (lock), "r" (old));
+
+ return (res == old);
+}
+
#else
typedef volatile uint32_t ngx_atomic_t;