Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_PROCESS_H_INCLUDED_
0009 #define _NGX_PROCESS_H_INCLUDED_
0010 
0011 
0012 #include <ngx_setaffinity.h>
0013 #include <ngx_setproctitle.h>
0014 
0015 
0016 typedef pid_t       ngx_pid_t;
0017 
0018 #define NGX_INVALID_PID  -1
0019 
0020 typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
0021 
0022 typedef struct {
0023     ngx_pid_t           pid;
0024     int                 status;
0025     ngx_socket_t        channel[2];
0026 
0027     ngx_spawn_proc_pt   proc;
0028     void               *data;
0029     char               *name;
0030 
0031     unsigned            respawn:1;
0032     unsigned            just_spawn:1;
0033     unsigned            detached:1;
0034     unsigned            exiting:1;
0035     unsigned            exited:1;
0036 } ngx_process_t;
0037 
0038 
0039 typedef struct {
0040     char         *path;
0041     char         *name;
0042     char *const  *argv;
0043     char *const  *envp;
0044 } ngx_exec_ctx_t;
0045 
0046 
0047 #define NGX_MAX_PROCESSES         1024
0048 
0049 #define NGX_PROCESS_NORESPAWN     -1
0050 #define NGX_PROCESS_JUST_SPAWN    -2
0051 #define NGX_PROCESS_RESPAWN       -3
0052 #define NGX_PROCESS_JUST_RESPAWN  -4
0053 #define NGX_PROCESS_DETACHED      -5
0054 
0055 
0056 #define ngx_getpid   getpid
0057 #define ngx_getppid  getppid
0058 
0059 #ifndef ngx_log_pid
0060 #define ngx_log_pid  ngx_pid
0061 #endif
0062 
0063 
0064 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle,
0065     ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn);
0066 ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);
0067 ngx_int_t ngx_init_signals(ngx_log_t *log);
0068 void ngx_debug_point(void);
0069 
0070 
0071 #if (NGX_HAVE_SCHED_YIELD)
0072 #define ngx_sched_yield()  sched_yield()
0073 #else
0074 #define ngx_sched_yield()  usleep(1)
0075 #endif
0076 
0077 
0078 extern int            ngx_argc;
0079 extern char         **ngx_argv;
0080 extern char         **ngx_os_argv;
0081 
0082 extern ngx_pid_t      ngx_pid;
0083 extern ngx_pid_t      ngx_parent;
0084 extern ngx_socket_t   ngx_channel;
0085 extern ngx_int_t      ngx_process_slot;
0086 extern ngx_int_t      ngx_last_process;
0087 extern ngx_process_t  ngx_processes[NGX_MAX_PROCESSES];
0088 
0089 
0090 #endif /* _NGX_PROCESS_H_INCLUDED_ */