summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-03-04 06:33:48 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-03-04 06:33:48 +0000
commit6a644c694de6a7afc87d25395c2cf6fcc46c4e6f (patch)
treed1e6cb8b9cc688cbfcbc83c3e065930c36244715 /src/core
parentff148df8f694212e2cf13f0d43532949433831a2 (diff)
downloadnginx-6a644c694de6a7afc87d25395c2cf6fcc46c4e6f.tar.gz
nginx-6a644c694de6a7afc87d25395c2cf6fcc46c4e6f.tar.bz2
nginx-0.0.1-2003-03-04-09:33:48 import
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_conf_file.c44
-rw-r--r--src/core/ngx_conf_file.h4
-rw-r--r--src/core/ngx_config.h10
3 files changed, 55 insertions, 3 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 1d78f7275..e38bbcede 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -108,7 +108,13 @@ ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data);
#endif
if (!(cmd->type & NGX_CONF_ANY)
- && !(cmd->type & argument_number[cf->args->nelts - 1]))
+ && ((cmd->type & NGX_CONF_FLAG && cf->args->nelts != 2)
+ || (!(cmd->type & NGX_CONF_FLAG)
+ && !(cmd->type
+ & argument_number[cf->args->nelts - 1])
+ )
+ )
+ )
{
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid number arguments in "
@@ -143,7 +149,11 @@ ngx_log_debug(cf->log, "rv: %d" _ rv);
} else {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "%s", rv);
+ "%s %s in %s:%d",
+ name->data, rv,
+ cf->conf_file->file.name.data,
+ cf->conf_file->line);
+
return NGX_CONF_ERROR;
}
}
@@ -383,6 +393,29 @@ ngx_log_debug(cf->log, "FOUND %d:'%s'" _ word->len _ word->data);
}
+char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf)
+{
+ int flag;
+ ngx_str_t *value;
+
+ value = (ngx_str_t *) cf->args->elts;
+
+ if (ngx_strcasecmp(value[1].data, "on") == 0) {
+ flag = 1;
+
+ } else if (ngx_strcasecmp(value[1].data, "off") == 0) {
+ flag = 0;
+
+ } else {
+ return "must be \"on\" or \"off\"";
+ }
+
+ *(int *) (conf + cmd->offset) = flag;
+
+ return NGX_CONF_OK;
+}
+
+
char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf)
{
ngx_str_t *field, *value;
@@ -427,7 +460,12 @@ char *ngx_conf_set_time_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf)
return "value must be greater or equal to zero";
}
- *(int *) (conf + cmd->offset) = size;
+ *(int *) (conf + cmd->offset) = size * 1000;
return NGX_CONF_OK;
}
+
+char *ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, char *conf)
+{
+ return "unsupported on this platform";
+}
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 9573ab9f2..56ed4a1d7 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -18,6 +18,7 @@
#define NGX_CONF_ARGS_NUMBER 0x00ffff
#define NGX_CONF_ANY 0x010000
#define NGX_CONF_BLOCK 0x020000
+#define NGX_CONF_FLAG 0x040000
#define NGX_CONF_UNSET -1
@@ -89,10 +90,13 @@ struct ngx_conf_s {
}
+#define addressof(addr) ((int) &addr)
+
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
+char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf);
char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf);
char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf);
char *ngx_conf_set_time_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf);
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 1a97b098b..6b26ad826 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -189,6 +189,16 @@
#include <sys/event.h>
#endif
+/* kqueue's NOTE_LOWAT */
+#if (__FreeBSD__ == 4 && __FreeBSD_version >= 430000) \
+ || __FreeBSD_version >= 500018
+
+#ifndef HAVE_LOWAT_EVENT
+#define HAVE_LOWAT_EVENT 1
+#endif
+
+#endif
+
#endif /* FreeBSD kqueue */