2002-12-23 14:29:22 +08:00
|
|
|
#ifndef _NGX_PROCESS_H_INCLUDED_
|
|
|
|
#define _NGX_PROCESS_H_INCLUDED_
|
|
|
|
|
|
|
|
|
2003-11-20 00:26:41 +08:00
|
|
|
typedef pid_t ngx_pid_t;
|
|
|
|
|
2004-01-06 04:55:48 +08:00
|
|
|
typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ngx_pid_t pid;
|
|
|
|
int status;
|
|
|
|
|
|
|
|
ngx_spawn_proc_pt proc;
|
|
|
|
void *data;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
unsigned respawn:1;
|
|
|
|
unsigned detached:1;
|
2004-01-13 14:39:14 +08:00
|
|
|
unsigned signal:1;
|
2004-01-06 04:55:48 +08:00
|
|
|
unsigned exiting:1;
|
2004-01-13 14:39:14 +08:00
|
|
|
unsigned exited:1;
|
2004-01-06 04:55:48 +08:00
|
|
|
} ngx_process_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *path;
|
|
|
|
char *name;
|
|
|
|
char *const *argv;
|
|
|
|
char *const *envp;
|
|
|
|
} ngx_exec_ctx_t;
|
|
|
|
|
|
|
|
|
2004-01-09 05:02:06 +08:00
|
|
|
#define NGX_PROCESS_SINGLE 0
|
|
|
|
#define NGX_PROCESS_MASTER 1
|
|
|
|
#define NGX_PROCESS_WORKER 2
|
2002-12-23 14:29:22 +08:00
|
|
|
|
2004-01-06 04:55:48 +08:00
|
|
|
#define NGX_MAX_PROCESSES 1024
|
|
|
|
|
2004-01-14 00:43:23 +08:00
|
|
|
#define NGX_PROCESS_NORESPAWN -1
|
|
|
|
#define NGX_PROCESS_RESPAWN -2
|
2004-01-06 04:55:48 +08:00
|
|
|
#define NGX_PROCESS_DETACHED -3
|
|
|
|
|
|
|
|
|
2004-01-08 16:47:17 +08:00
|
|
|
#define ngx_getpid getpid
|
|
|
|
|
2004-01-14 00:43:23 +08:00
|
|
|
ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
|
2004-01-06 04:55:48 +08:00
|
|
|
ngx_spawn_proc_pt proc, void *data,
|
|
|
|
char *name, ngx_int_t respawn);
|
|
|
|
ngx_int_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
|
2004-01-09 05:02:06 +08:00
|
|
|
void ngx_signal_processes(ngx_cycle_t *cycle, ngx_int_t signo);
|
2004-01-06 04:55:48 +08:00
|
|
|
void ngx_respawn_processes(ngx_cycle_t *cycle);
|
|
|
|
void ngx_process_get_status(void);
|
2002-12-23 14:29:22 +08:00
|
|
|
|
2004-01-06 04:55:48 +08:00
|
|
|
extern ngx_uint_t ngx_last_process;
|
|
|
|
extern ngx_process_t ngx_processes[NGX_MAX_PROCESSES];
|
2003-11-20 00:26:41 +08:00
|
|
|
|
|
|
|
|
2002-12-23 14:29:22 +08:00
|
|
|
#endif /* _NGX_PROCESS_H_INCLUDED_ */
|