Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ngx_process.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) Nginx, Inc.
5  */
6 
7 
8 #ifndef _NGX_PROCESS_H_INCLUDED_
9 #define _NGX_PROCESS_H_INCLUDED_
10 
11 
12 #include <ngx_setaffinity.h>
13 #include <ngx_setproctitle.h>
14 
15 
16 typedef pid_t ngx_pid_t;
17 
18 #define NGX_INVALID_PID -1
19 
20 typedef void (*ngx_spawn_proc_pt) (ngx_cycle_t *cycle, void *data);
21 
22 typedef struct {
24  int status;
25  ngx_socket_t channel[2];
26 
28  void *data;
29  char *name;
30 
31  unsigned respawn:1;
32  unsigned just_spawn:1;
33  unsigned detached:1;
34  unsigned exiting:1;
35  unsigned exited:1;
37 
38 
39 typedef struct {
40  char *path;
41  char *name;
42  char *const *argv;
43  char *const *envp;
45 
46 
47 #define NGX_MAX_PROCESSES 1024
48 
49 #define NGX_PROCESS_NORESPAWN -1
50 #define NGX_PROCESS_JUST_SPAWN -2
51 #define NGX_PROCESS_RESPAWN -3
52 #define NGX_PROCESS_JUST_RESPAWN -4
53 #define NGX_PROCESS_DETACHED -5
54 
55 
56 #define ngx_getpid getpid
57 
58 #ifndef ngx_log_pid
59 #define ngx_log_pid ngx_pid
60 #endif
61 
62 
64  ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn);
67 void ngx_debug_point(void);
68 
69 
70 #if (NGX_HAVE_SCHED_YIELD)
71 #define ngx_sched_yield() sched_yield()
72 #else
73 #define ngx_sched_yield() usleep(1)
74 #endif
75 
76 
77 extern int ngx_argc;
78 extern char **ngx_argv;
79 extern char **ngx_os_argv;
80 
81 extern ngx_pid_t ngx_pid;
86 
87 
88 #endif /* _NGX_PROCESS_H_INCLUDED_ */