diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-08-26 13:37:44 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-08-26 13:37:44 +0300 |
commit | e64494ba2cba9322f9594f26bcc69cb3a2441105 (patch) | |
tree | 4f0907e6f1000755a3d2f87c86932b18f1293401 /src/nxt_runtime.c | |
parent | d3a6d7805f9f869f3a786080a9e0586b4844034f (diff) | |
download | unit-e64494ba2cba9322f9594f26bcc69cb3a2441105.tar.gz unit-e64494ba2cba9322f9594f26bcc69cb3a2441105.tar.bz2 |
Added configure option --pid=FILE.
A pid file name can be relative.
The default pid file name is "nginext.pid".
Diffstat (limited to '')
-rw-r--r-- | src/nxt_runtime.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index a60498d7..59b209aa 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -78,13 +78,6 @@ nxt_runtime_create(nxt_task_t *task) nxt_thread_mutex_create(&rt->processes_mutex); - rt->prefix = nxt_current_directory(mp); - if (nxt_slow_path(rt->prefix == NULL)) { - goto fail; - } - - rt->conf_prefix = rt->prefix; - rt->services = nxt_services_init(mp); if (nxt_slow_path(rt->services == NULL)) { goto fail; @@ -698,7 +691,6 @@ static nxt_int_t nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) { nxt_int_t ret; - nxt_str_t *prefix; nxt_file_t *file; nxt_file_name_str_t file_name; const nxt_event_interface_t *interface; @@ -709,7 +701,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) rt->auxiliary_threads = 2; rt->user_cred.user = "nobody"; rt->group = NULL; - rt->pid = "nginext.pid"; + rt->pid = NXT_PID; rt->log = NXT_LOG; if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) { @@ -733,10 +725,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) rt->engine = interface->name; - prefix = nxt_file_name_is_absolute(rt->pid) ? NULL : rt->prefix; - - ret = nxt_file_name_create(rt->mem_pool, &file_name, "%V%s%Z", - prefix, rt->pid); + ret = nxt_file_name_create(rt->mem_pool, &file_name, "s%Z", rt->pid); if (nxt_slow_path(ret != NXT_OK)) { return NXT_ERROR; } @@ -768,6 +757,7 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) "nginext version: " NXT_VERSION "\n" "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n"; + static const char no_pid[] = "option \"--pid\" requires filename\n"; static const char no_log[] = "option \"--log\" requires filename\n"; argv = &nxt_process_argv[1]; @@ -843,8 +833,7 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) if (nxt_strcmp(p, "--pid") == 0) { if (*argv == NULL) { - nxt_log(task, NXT_LOG_CRIT, - "no argument for option \"--pid\""); + write(STDERR_FILENO, no_pid, sizeof(no_pid) - 1); return NXT_ERROR; } |