diff options
author | Alexander Borisov <alexander.borisov@nginx.com> | 2018-01-31 15:47:00 +0300 |
---|---|---|
committer | Alexander Borisov <alexander.borisov@nginx.com> | 2018-01-31 15:47:00 +0300 |
commit | 960962ddce87f6b401523b4426e8b5c61544ec7b (patch) | |
tree | 3c6fa7d9871701bca291ea5899a98397dacc5a87 /src/nxt_main_process.c | |
parent | 311db93f006153c309b975942c2415655e2ff417 (diff) | |
download | unit-960962ddce87f6b401523b4426e8b5c61544ec7b.tar.gz unit-960962ddce87f6b401523b4426e8b5c61544ec7b.tar.bz2 |
Added Perl support.
Diffstat (limited to 'src/nxt_main_process.c')
-rw-r--r-- | src/nxt_main_process.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index fedd30cd..d5978d7e 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -20,6 +20,12 @@ typedef struct { } nxt_listening_socket_t; +typedef struct { + nxt_int_t size; + nxt_conf_map_t *map; +} nxt_common_app_member_t; + + static nxt_int_t nxt_main_process_port_create(nxt_task_t *task, nxt_runtime_t *rt); static void nxt_main_process_title(nxt_task_t *task); @@ -113,7 +119,10 @@ static nxt_conf_map_t nxt_common_app_conf[] = { NXT_CONF_MAP_CSTRZ, offsetof(nxt_common_app_conf_t, working_directory), }, +}; + +static nxt_conf_map_t nxt_common_python_app_conf[] = { { nxt_string("home"), NXT_CONF_MAP_CSTRZ, @@ -131,7 +140,10 @@ static nxt_conf_map_t nxt_common_app_conf[] = { NXT_CONF_MAP_STR, offsetof(nxt_common_app_conf_t, u.python.module), }, +}; + +static nxt_conf_map_t nxt_common_php_app_conf[] = { { nxt_string("root"), NXT_CONF_MAP_CSTRZ, @@ -149,7 +161,10 @@ static nxt_conf_map_t nxt_common_app_conf[] = { NXT_CONF_MAP_STR, offsetof(nxt_common_app_conf_t, u.php.index), }, +}; + +static nxt_conf_map_t nxt_common_go_app_conf[] = { { nxt_string("executable"), NXT_CONF_MAP_CSTRZ, @@ -158,6 +173,23 @@ static nxt_conf_map_t nxt_common_app_conf[] = { }; +static nxt_conf_map_t nxt_common_perl_app_conf[] = { + { + nxt_string("script"), + NXT_CONF_MAP_CSTRZ, + offsetof(nxt_common_app_conf_t, u.perl.script), + }, +}; + + +static nxt_common_app_member_t nxt_common_members[] = { + { nxt_nitems(nxt_common_python_app_conf), nxt_common_python_app_conf }, + { nxt_nitems(nxt_common_php_app_conf), nxt_common_php_app_conf }, + { nxt_nitems(nxt_common_go_app_conf), nxt_common_go_app_conf }, + { nxt_nitems(nxt_common_perl_app_conf), nxt_common_perl_app_conf }, +}; + + static void nxt_port_main_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) { @@ -171,7 +203,7 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) { u_char *start; nxt_mp_t *mp; - nxt_int_t ret; + nxt_int_t ret, idx; nxt_buf_t *b; nxt_port_t *port; nxt_conf_value_t *conf; @@ -219,10 +251,18 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) nxt_nitems(nxt_common_app_conf), &app_conf); if (ret != NXT_OK) { nxt_log(task, NXT_LOG_CRIT, "root map error"); - goto failed; } + idx = nxt_app_parse_type(app_conf.type.start, app_conf.type.length); + + nxt_assert(ret != NXT_APP_UNKNOWN); + + ret = nxt_conf_map_object(mp, conf, nxt_common_members[idx].map, + nxt_common_members[idx].size, &app_conf); + + nxt_assert(ret == NXT_OK); + ret = nxt_main_start_worker_process(task, task->thread->runtime, &app_conf, msg->port_msg.stream); |