summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-26 13:37:44 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-26 13:37:44 +0300
commit7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec (patch)
tree37f69782ab933eb36d305d8d3e6e90c42417a711 /src/nxt_runtime.c
parent9aaa7d8c20e58ed380225cbbbd05248539d2f500 (diff)
downloadunit-7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec.tar.gz
unit-7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec.tar.bz2
Added configure and command line option --modules.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index d6518fbe..f070bd94 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -703,6 +703,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
rt->group = NXT_GROUP;
rt->pid = NXT_PID;
rt->log = NXT_LOG;
+ rt->modules = NXT_MODULES;
if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) {
return NXT_ERROR;
@@ -740,6 +741,14 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt)
file = nxt_list_first(rt->log_files);
file->name = file_name.start;
+ ret = nxt_file_name_create(rt->mem_pool, &file_name, "%snginext.*%Z",
+ rt->modules);
+ if (nxt_slow_path(ret != NXT_OK)) {
+ return NXT_ERROR;
+ }
+
+ rt->modules = (char *) file_name.start;
+
return NXT_OK;
}
@@ -761,6 +770,8 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
static const char no_group[] = "option \"--group\" requires group name\n";
static const char no_pid[] = "option \"--pid\" requires filename\n";
static const char no_log[] = "option \"--log\" requires filename\n";
+ static const char no_modules[] =
+ "option \"--modules\" requires directory\n";
argv = &nxt_process_argv[1];
@@ -857,6 +868,19 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
continue;
}
+ if (nxt_strcmp(p, "--modules") == 0) {
+ if (*argv == NULL) {
+ write(STDERR_FILENO, no_modules, sizeof(no_modules) - 1);
+ return NXT_ERROR;
+ }
+
+ p = *argv++;
+
+ rt->modules = p;
+
+ continue;
+ }
+
if (nxt_strcmp(p, "--no-daemon") == 0) {
rt->daemon = 0;
continue;