nginx/src/os/unix/ngx_process.h

86 lines
1.8 KiB
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
2002-12-23 14:29:22 +08:00
#ifndef _NGX_PROCESS_H_INCLUDED_
#define _NGX_PROCESS_H_INCLUDED_
#include <ngx_setproctitle.h>
2003-11-20 00:26:41 +08:00
typedef pid_t ngx_pid_t;
#define NGX_INVALID_PID -1
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;
2004-06-15 15:55:11 +08:00
ngx_socket_t channel[2];
2004-01-06 04:55:48 +08:00
ngx_spawn_proc_pt proc;
void *data;
char *name;
unsigned respawn:1;
2004-04-16 13:14:16 +08:00
unsigned just_respawn:1;
2004-01-06 04:55:48 +08:00
unsigned detached:1;
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-04-16 13:14:16 +08:00
#define NGX_MAX_PROCESSES 1024
2004-01-06 04:55:48 +08:00
2004-04-16 13:14:16 +08:00
#define NGX_PROCESS_NORESPAWN -1
#define NGX_PROCESS_RESPAWN -2
#define NGX_PROCESS_JUST_RESPAWN -3
#define NGX_PROCESS_DETACHED -4
2004-01-06 04:55:48 +08:00
2004-02-24 04:57:12 +08:00
#define ngx_getpid getpid
#ifndef ngx_log_pid
2004-02-24 04:57:12 +08:00
#define ngx_log_pid ngx_pid
#endif
2004-01-08 16:47:17 +08:00
2004-01-14 00:43:23 +08:00
ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn);
2004-03-05 00:34:23 +08:00
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);
2004-06-23 13:54:27 +08:00
#if (NGX_HAVE_SCHED_YIELD)
2004-06-30 23:30:41 +08:00
#define ngx_sched_yield() sched_yield()
#else
#define ngx_sched_yield() usleep(1)
#endif
2004-06-30 23:30:41 +08:00
extern int ngx_argc;
extern char **ngx_argv;
extern char **ngx_os_argv;
2002-12-23 14:29:22 +08:00
2004-02-04 00:43:54 +08:00
extern ngx_pid_t ngx_pid;
2004-06-15 15:55:11 +08:00
extern ngx_socket_t ngx_channel;
2004-06-19 00:22:16 +08:00
extern ngx_int_t ngx_process_slot;
extern ngx_int_t ngx_last_process;
2004-01-06 04:55:48 +08:00
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_ */