nxt_runtime.c (232:43f9808200cd) nxt_runtime.c (233:60bb2517a61d)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 689 unchanged lines hidden (view full) ---

698 rt->daemon = 1;
699 rt->master_process = 1;
700 rt->engine_connections = 256;
701 rt->auxiliary_threads = 2;
702 rt->user_cred.user = NXT_USER;
703 rt->group = NXT_GROUP;
704 rt->pid = NXT_PID;
705 rt->log = NXT_LOG;
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 689 unchanged lines hidden (view full) ---

698 rt->daemon = 1;
699 rt->master_process = 1;
700 rt->engine_connections = 256;
701 rt->auxiliary_threads = 2;
702 rt->user_cred.user = NXT_USER;
703 rt->group = NXT_GROUP;
704 rt->pid = NXT_PID;
705 rt->log = NXT_LOG;
706 rt->modules = NXT_MODULES;
706
707 if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) {
708 return NXT_ERROR;
709 }
710
711 if (nxt_runtime_controller_socket(task, rt) != NXT_OK) {
712 return NXT_ERROR;
713 }

--- 21 unchanged lines hidden (view full) ---

735 ret = nxt_file_name_create(rt->mem_pool, &file_name, "%s%Z", rt->log);
736 if (nxt_slow_path(ret != NXT_OK)) {
737 return NXT_ERROR;
738 }
739
740 file = nxt_list_first(rt->log_files);
741 file->name = file_name.start;
742
707
708 if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) {
709 return NXT_ERROR;
710 }
711
712 if (nxt_runtime_controller_socket(task, rt) != NXT_OK) {
713 return NXT_ERROR;
714 }

--- 21 unchanged lines hidden (view full) ---

736 ret = nxt_file_name_create(rt->mem_pool, &file_name, "%s%Z", rt->log);
737 if (nxt_slow_path(ret != NXT_OK)) {
738 return NXT_ERROR;
739 }
740
741 file = nxt_list_first(rt->log_files);
742 file->name = file_name.start;
743
744 ret = nxt_file_name_create(rt->mem_pool, &file_name, "%snginext.*%Z",
745 rt->modules);
746 if (nxt_slow_path(ret != NXT_OK)) {
747 return NXT_ERROR;
748 }
749
750 rt->modules = (char *) file_name.start;
751
743 return NXT_OK;
744}
745
746
747static nxt_int_t
748nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
749{
750 char *p, **argv;

--- 5 unchanged lines hidden (view full) ---

756 static const char version[] =
757 "nginext version: " NXT_VERSION "\n"
758 "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
759
760 static const char no_user[] = "option \"--user\" requires username\n";
761 static const char no_group[] = "option \"--group\" requires group name\n";
762 static const char no_pid[] = "option \"--pid\" requires filename\n";
763 static const char no_log[] = "option \"--log\" requires filename\n";
752 return NXT_OK;
753}
754
755
756static nxt_int_t
757nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
758{
759 char *p, **argv;

--- 5 unchanged lines hidden (view full) ---

765 static const char version[] =
766 "nginext version: " NXT_VERSION "\n"
767 "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
768
769 static const char no_user[] = "option \"--user\" requires username\n";
770 static const char no_group[] = "option \"--group\" requires group name\n";
771 static const char no_pid[] = "option \"--pid\" requires filename\n";
772 static const char no_log[] = "option \"--log\" requires filename\n";
773 static const char no_modules[] =
774 "option \"--modules\" requires directory\n";
764
765 argv = &nxt_process_argv[1];
766
767 while (*argv != NULL) {
768 p = *argv++;
769
770 if (nxt_strcmp(p, "--listen") == 0) {
771 if (*argv == NULL) {

--- 80 unchanged lines hidden (view full) ---

852
853 p = *argv++;
854
855 rt->log = p;
856
857 continue;
858 }
859
775
776 argv = &nxt_process_argv[1];
777
778 while (*argv != NULL) {
779 p = *argv++;
780
781 if (nxt_strcmp(p, "--listen") == 0) {
782 if (*argv == NULL) {

--- 80 unchanged lines hidden (view full) ---

863
864 p = *argv++;
865
866 rt->log = p;
867
868 continue;
869 }
870
871 if (nxt_strcmp(p, "--modules") == 0) {
872 if (*argv == NULL) {
873 write(STDERR_FILENO, no_modules, sizeof(no_modules) - 1);
874 return NXT_ERROR;
875 }
876
877 p = *argv++;
878
879 rt->modules = p;
880
881 continue;
882 }
883
860 if (nxt_strcmp(p, "--no-daemon") == 0) {
861 rt->daemon = 0;
862 continue;
863 }
864
865 if (nxt_strcmp(p, "--version") == 0) {
866 write(STDERR_FILENO, version, sizeof(version) - 1);
867 exit(0);

--- 868 unchanged lines hidden ---
884 if (nxt_strcmp(p, "--no-daemon") == 0) {
885 rt->daemon = 0;
886 continue;
887 }
888
889 if (nxt_strcmp(p, "--version") == 0) {
890 write(STDERR_FILENO, version, sizeof(version) - 1);
891 exit(0);

--- 868 unchanged lines hidden ---