summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nxt_main.c4
-rw-r--r--src/nxt_main.h4
-rw-r--r--src/nxt_runtime.c17
3 files changed, 19 insertions, 6 deletions
diff --git a/src/nxt_main.c b/src/nxt_main.c
index 7cd032d5..6f7aec39 100644
--- a/src/nxt_main.c
+++ b/src/nxt_main.c
@@ -24,14 +24,14 @@ main(int argc, char **argv)
nxt_main_log.handler = nxt_log_time_handler;
- nxt_log(&nxt_main_task, NXT_LOG_INFO, "nginext started");
-
ret = nxt_runtime_create(&nxt_main_task);
if (ret != NXT_OK) {
return 1;
}
+ nxt_log(&nxt_main_task, NXT_LOG_INFO, "nginext started");
+
nxt_event_engine_start(nxt_main_task.thread->engine);
nxt_unreachable();
diff --git a/src/nxt_main.h b/src/nxt_main.h
index 72b243f4..128647eb 100644
--- a/src/nxt_main.h
+++ b/src/nxt_main.h
@@ -10,6 +10,10 @@
#include <nxt_auto_config.h>
+
+#define NXT_VERSION "0.1"
+
+
typedef struct nxt_port_s nxt_port_t;
typedef struct nxt_task_s nxt_task_t;
typedef struct nxt_port_recv_msg_s nxt_port_recv_msg_t;
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 4de0404c..ff4dd54d 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -133,6 +133,10 @@ nxt_runtime_create(nxt_task_t *task)
rt->start = nxt_runtime_initial_start;
+ if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
+ goto fail;
+ }
+
nxt_work_queue_add(&task->thread->engine->fast_work_queue,
nxt_runtime_start, task, rt, NULL);
@@ -346,10 +350,6 @@ nxt_runtime_start(nxt_task_t *task, void *obj, void *data)
task->thread->log->ctx_handler = NULL;
task->thread->log->ctx = NULL;
- if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
- goto fail;
- }
-
if (nxt_runtime_log_files_create(task, rt) != NXT_OK) {
goto fail;
}
@@ -797,6 +797,10 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
nxt_str_t addr;
nxt_sockaddr_t *sa;
+ const static char version[] =
+ "nginext version: " NXT_VERSION "\n"
+ "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
+
argv = nxt_process_argv;
while (*argv != NULL) {
@@ -900,6 +904,11 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
rt->daemon = 0;
continue;
}
+
+ if (nxt_strcmp(p, "--version") == 0) {
+ write(STDERR_FILENO, version, sizeof(version) - 1);
+ exit(0);
+ }
}
return NXT_OK;