Added configure option --pid=FILE.
A pid file name can be relative. The default pid file name is "nginext.pid".
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user