0
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
644
|
4 * Copyright (C) Nginx, Inc.
|
0
|
5 */
|
|
6
|
|
7
|
|
8 #ifndef _NGX_PROCESS_H_INCLUDED_
|
|
9 #define _NGX_PROCESS_H_INCLUDED_
|
|
10
|
|
11
|
80
|
12 #include <ngx_setproctitle.h>
|
|
13
|
|
14
|
0
|
15 typedef pid_t ngx_pid_t;
|
|
16
|
92
|
17 #define NGX_INVALID_PID -1
|
|
18
|
0
|
19 typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
|
|
20
|
|
21 typedef struct {
|
|
22 ngx_pid_t pid;
|
|
23 int status;
|
|
24 ngx_socket_t channel[2];
|
|
25
|
|
26 ngx_spawn_proc_pt proc;
|
|
27 void *data;
|
|
28 char *name;
|
|
29
|
|
30 unsigned respawn:1;
|
514
|
31 unsigned just_spawn:1;
|
0
|
32 unsigned detached:1;
|
|
33 unsigned exiting:1;
|
|
34 unsigned exited:1;
|
|
35 } ngx_process_t;
|
|
36
|
|
37
|
|
38 typedef struct {
|
|
39 char *path;
|
|
40 char *name;
|
|
41 char *const *argv;
|
|
42 char *const *envp;
|
|
43 } ngx_exec_ctx_t;
|
|
44
|
|
45
|
|
46 #define NGX_MAX_PROCESSES 1024
|
|
47
|
|
48 #define NGX_PROCESS_NORESPAWN -1
|
514
|
49 #define NGX_PROCESS_JUST_SPAWN -2
|
|
50 #define NGX_PROCESS_RESPAWN -3
|
|
51 #define NGX_PROCESS_JUST_RESPAWN -4
|
|
52 #define NGX_PROCESS_DETACHED -5
|
0
|
53
|
|
54
|
|
55 #define ngx_getpid getpid
|
108
|
56
|
|
57 #ifndef ngx_log_pid
|
0
|
58 #define ngx_log_pid ngx_pid
|
108
|
59 #endif
|
|
60
|
0
|
61
|
|
62 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
|
42
|
63 ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn);
|
0
|
64 ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
|
88
|
65 ngx_int_t ngx_init_signals(ngx_log_t *log);
|
10
|
66 void ngx_debug_point(void);
|
0
|
67
|
4
|
68
|
|
69 #if (NGX_HAVE_SCHED_YIELD)
|
0
|
70 #define ngx_sched_yield() sched_yield()
|
4
|
71 #else
|
|
72 #define ngx_sched_yield() usleep(1)
|
|
73 #endif
|
|
74
|
0
|
75
|
2
|
76 extern int ngx_argc;
|
|
77 extern char **ngx_argv;
|
|
78 extern char **ngx_os_argv;
|
0
|
79
|
|
80 extern ngx_pid_t ngx_pid;
|
|
81 extern ngx_socket_t ngx_channel;
|
|
82 extern ngx_int_t ngx_process_slot;
|
|
83 extern ngx_int_t ngx_last_process;
|
|
84 extern ngx_process_t ngx_processes[NGX_MAX_PROCESSES];
|
|
85
|
|
86
|
|
87 #endif /* _NGX_PROCESS_H_INCLUDED_ */
|