aboutsummaryrefslogtreecommitdiffstats
path: root/app/nginx/src/os/unix/ngx_process.h
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2017-10-31 12:40:17 +0000
committerKonstantin Ananyev <konstantin.ananyev@intel.com>2017-10-31 14:19:39 +0000
commite18a033b921d0d79fa8278f853548e6125b93e0c (patch)
treea6a55edf6ddceef824561818c9836914c326340d /app/nginx/src/os/unix/ngx_process.h
parent7e18fa1bf263822c46d7431a911b41d6377d5f69 (diff)
Integrate TLDK with NGINX
Created a clone of nginx (from https://github.com/nginx/nginx) to demonstrate and benchmark TLDK library integrated with real world application. A new nginx module is created and and BSD socket-like API is implemented on top of native TLDK API. Note, that right now only minimalistic subset of socket-like API is provided: - accept - close - readv - recv - writev so only limited nginx functionality is available for a moment. Change-Id: Ie1efe9349a0538da4348a48fb8306cbf636b5a92 Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com> Signed-off-by: Remy Horton <remy.horton@intel.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'app/nginx/src/os/unix/ngx_process.h')
-rw-r--r--app/nginx/src/os/unix/ngx_process.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/app/nginx/src/os/unix/ngx_process.h b/app/nginx/src/os/unix/ngx_process.h
new file mode 100644
index 0000000..7b5e8c0
--- /dev/null
+++ b/app/nginx/src/os/unix/ngx_process.h
@@ -0,0 +1,88 @@
+
+/*
+ * Copyright (C) Igor Sysoev
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_PROCESS_H_INCLUDED_
+#define _NGX_PROCESS_H_INCLUDED_
+
+
+#include <ngx_setaffinity.h>
+#include <ngx_setproctitle.h>
+
+
+typedef pid_t ngx_pid_t;
+
+#define NGX_INVALID_PID -1
+
+typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
+
+typedef struct {
+ ngx_pid_t pid;
+ int status;
+ ngx_socket_t channel[2];
+
+ ngx_spawn_proc_pt proc;
+ void *data;
+ char *name;
+
+ unsigned respawn:1;
+ unsigned just_spawn:1;
+ unsigned detached:1;
+ unsigned exiting:1;
+ unsigned exited:1;
+} ngx_process_t;
+
+
+typedef struct {
+ char *path;
+ char *name;
+ char *const *argv;
+ char *const *envp;
+} ngx_exec_ctx_t;
+
+
+#define NGX_MAX_PROCESSES 1024
+
+#define NGX_PROCESS_NORESPAWN -1
+#define NGX_PROCESS_JUST_SPAWN -2
+#define NGX_PROCESS_RESPAWN -3
+#define NGX_PROCESS_JUST_RESPAWN -4
+#define NGX_PROCESS_DETACHED -5
+
+
+#define ngx_getpid getpid
+
+#ifndef ngx_log_pid
+#define ngx_log_pid ngx_pid
+#endif
+
+
+ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
+ ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn);
+ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
+ngx_int_t ngx_init_signals(ngx_log_t *log);
+void ngx_debug_point(void);
+
+
+#if (NGX_HAVE_SCHED_YIELD)
+#define ngx_sched_yield() sched_yield()
+#else
+#define ngx_sched_yield() usleep(1)
+#endif
+
+
+extern int ngx_argc;
+extern char **ngx_argv;
+extern char **ngx_os_argv;
+
+extern ngx_pid_t ngx_pid;
+extern ngx_socket_t ngx_channel;
+extern ngx_int_t ngx_process_slot;
+extern ngx_int_t ngx_last_process;
+extern ngx_process_t ngx_processes[NGX_MAX_PROCESSES];
+
+
+#endif /* _NGX_PROCESS_H_INCLUDED_ */