summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-03-09 18:03:27 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-03-09 18:03:27 +0300
commit6f2c9acd1841ca20a1388b34aef64e9f00459090 (patch)
treec0b9c1063ec464027d1ca29a793f6c0b7a6878d5 /src/nxt_runtime.h
parent5745e4826427155e29c1d520fe77811a0f570689 (diff)
downloadunit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.gz
unit-6f2c9acd1841ca20a1388b34aef64e9f00459090.tar.bz2
Processes refactoring.
The cycle has been renamed to the runtime.
Diffstat (limited to 'src/nxt_runtime.h')
-rw-r--r--src/nxt_runtime.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/nxt_runtime.h b/src/nxt_runtime.h
new file mode 100644
index 00000000..3b384235
--- /dev/null
+++ b/src/nxt_runtime.h
@@ -0,0 +1,108 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) Valentin V. Bartenev
+ * Copyright (C) NGINX, Inc.
+ */
+
+#ifndef _NXT_RUNTIME_H_INCLUDED_
+#define _NXT_RUNTIME_H_INCLUDED_
+
+
+typedef void (*nxt_runtime_cont_t)(nxt_task_t *task);
+
+
+struct nxt_runtime_s {
+ nxt_mem_pool_t *mem_pool;
+
+ nxt_array_t *inherited_sockets; /* of nxt_listen_socket_t */
+ nxt_array_t *listen_sockets; /* of nxt_listen_socket_t */
+
+ nxt_array_t *services; /* of nxt_service_t */
+ nxt_array_t *engines; /* of nxt_event_engine_t */
+
+ nxt_runtime_cont_t start;
+
+ nxt_str_t *conf_prefix;
+ nxt_str_t *prefix;
+
+ nxt_str_t hostname;
+
+ nxt_file_name_t *pid_file;
+
+#if (NXT_THREADS)
+ nxt_array_t *thread_pools; /* of nxt_thread_pool_t */
+ nxt_runtime_cont_t continuation;
+#endif
+
+ nxt_array_t *processes; /* of nxt_process_t */
+
+ nxt_list_t *log_files; /* of nxt_file_t */
+
+ uint32_t last_engine_id;
+
+ nxt_process_type_t type;
+
+ nxt_timer_t timer;
+
+ uint8_t daemon;
+ uint8_t batch;
+ uint8_t master_process;
+ const char *engine;
+ uint32_t engine_connections;
+ uint32_t worker_processes;
+ uint32_t auxiliary_threads;
+ nxt_user_cred_t user_cred;
+ const char *group;
+ const char *pid;
+ const char *error_log;
+
+ nxt_sockaddr_t *controller_listen;
+ nxt_listen_socket_t *controller_socket;
+ nxt_str_t upstream;
+};
+
+
+
+typedef nxt_int_t (*nxt_module_init_t)(nxt_thread_t *thr, nxt_runtime_t *rt);
+
+
+nxt_int_t nxt_runtime_create(nxt_task_t *task);
+void nxt_runtime_quit(nxt_task_t *task);
+
+void nxt_runtime_event_engine_free(nxt_runtime_t *rt);
+
+#if (NXT_THREADS)
+nxt_int_t nxt_runtime_thread_pool_create(nxt_thread_t *thr, nxt_runtime_t *rt,
+ nxt_uint_t max_threads, nxt_nsec_t timeout);
+#endif
+
+
+nxt_process_t *nxt_runtime_new_process(nxt_runtime_t *rt);
+
+/* STUB */
+nxt_int_t nxt_runtime_controller_socket(nxt_task_t *task, nxt_runtime_t *rt);
+
+nxt_str_t *nxt_current_directory(nxt_mem_pool_t *mp);
+
+nxt_listen_socket_t *nxt_runtime_listen_socket_add(nxt_runtime_t *rt,
+ nxt_sockaddr_t *sa);
+nxt_int_t nxt_runtime_listen_sockets_create(nxt_task_t *task,
+ nxt_runtime_t *rt);
+nxt_int_t nxt_runtime_listen_sockets_enable(nxt_task_t *task,
+ nxt_runtime_t *rt);
+nxt_file_t *nxt_runtime_log_file_add(nxt_runtime_t *rt, nxt_str_t *name);
+
+/* STUB */
+void nxt_cdecl nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log,
+ const char *fmt, ...);
+
+void nxt_stream_connection_init(nxt_task_t *task, void *obj, void *data);
+nxt_int_t nxt_app_start(nxt_task_t *task, nxt_runtime_t *rt);
+
+
+extern nxt_module_init_t nxt_init_modules[];
+extern nxt_uint_t nxt_init_modules_n;
+
+
+#endif /* _NXT_RUNTIME_H_INCLIDED_ */