fix 'FastCgiConfig -autoUpdate'
[mod_fastcgi.git] / mod_fastcgi.h
blobd81a5b2566350664ef62406f53ddaa32157d72f9
1 /*
2 * $Id: mod_fastcgi.h,v 1.39 2002/02/04 19:41:56 robs Exp $
3 */
5 #ifndef MOD_FASTCGI_H
6 #define MOD_FASTCGI_H
8 #define MOD_FASTCGI_VERSION "2.2.13"
11 * # of idle seconds allowed to pass while connected to a FastCGI before aborting
13 #define FCGI_DEFAULT_IDLE_TIMEOUT 30
16 * (WIN32) # of sec to wait while trying to connect using a named pipe.
17 * This is overridden by -appConnTimeout, if set. This value is similiar
18 * to the OS specific (blocking) connect() timeout. According to XXX
19 * this is typically XXX sec.
21 #define FCGI_NAMED_PIPE_CONNECT_TIMEOUT 90
23 #define FCGI_DEFAULT_LISTEN_Q 100 /* listen queue (backlog) depth */
24 #define FCGI_DEFAULT_RESTART_DELAY 5 /* delay between restarts */
25 #define DEFAULT_INIT_START_DELAY 1 /* delay between starts */
26 #define FCGI_DEFAULT_PRIORITY 0 /* process priority - not used */
27 #define FCGI_MIN_EXEC_RETRY_DELAY 10 /* minimum number of seconds to
28 wait before restarting */
29 #define MAX_INIT_ENV_VARS 64 /* max # of -initial-env options */
31 /* max number of chars in a line of stderr we can handle from a FastCGI Server */
32 #define FCGI_SERVER_MAX_STDERR_LINE_LEN 1023
34 /* size of the buffer the PM uses to read records from the request handlers */
35 #define FCGI_MSGS_BUFSIZE 32 * 512
37 #define SERVER_BUFSIZE 8192
39 /* Dynamic FastCGI applications */
40 #define FCGI_DEFAULT_MAX_PROCS 50 /* maximum number of processes that
41 * are allowed to run on system */
42 #define FCGI_DEFAULT_MIN_PROCS 5 /* minimum number of processes that
43 * can be run without being killed
44 * off by the process manager */
45 #define FCGI_DEFAULT_MAX_CLASS_PROCS 10 /* maximum number of processes that
46 * are allowed to run for a single
47 * application class */
48 #define FCGI_DEFAULT_KILL_INTERVAL 300 /* number of seconds in which we
49 * should execute the kill policy
50 * by killing off extra instances */
51 #define FCGI_DEFAULT_UPDATE_INTERVAL 300 /* number of seconds in which we
52 * should recalculate the value of
53 * totalConnTime variable */
54 #define FCGI_DEFAULT_GAIN 0.5 /* value used as an exponent in the
55 * calculation of the exponentially
56 * decayed connection times;
57 * old values are scaled by
58 * (1-dynamicGain), so making it
59 * smaller weights them more heavily
60 * compared to the current value,
61 * which is scaled by dynamicGain */
62 #define FCGI_DEFAULT_THRESHOLD_1 0 /* if load falls below this value
63 * and we have only one instance
64 * running, it is killed off */
65 #define FCGI_DEFAULT_THRESHOLD_N 50 /* if load falls below this value
66 * and we have more than one
67 * instances, one is killed off */
68 #define FCGI_DEFAULT_START_PROCESS_DELAY 3 /* specifies the maximum number of
69 * seconds a server should wait in
70 * attempt to connect to fcgi app
71 * before sending FCGI_REQUEST_TIMEOUT_JOB */
74 * # of sec to wait in a non-blocking connect() to the FastCGI application
75 * before aborting the request, or 0 to indicate that blocking connect()s
76 * should be used. Non-blocking connect()s are problematic on many platforms.
78 #define FCGI_DEFAULT_APP_CONN_TIMEOUT 0
80 #define FCGI_DEFAULT_PROCESS_SLACK 5 /* if this number combined with the
81 * number of the currently running
82 * processes exceeds dynamicMaxProcs, then
83 * the KillDynamicProcs() is invoked */
84 #define FCGI_DEFAULT_RESTART_DYNAMIC 0 /* Do not restart dynamic processes */
85 #define FCGI_DEFAULT_AUTOUPDATE 0 /* do not automatically restart
86 * fcgi apps when the binary on the
87 * disk is changed. */
90 * Should data recieved from the FastCGI server be immediately flushed to
91 * the client? Default: FALSE
93 #define FCGI_FLUSH FALSE
95 #ifdef WIN32
97 /* # of millisecs to wait on the mbox mutex */
98 #define FCGI_MBOX_MUTEX_TIMEOUT 5000
100 #define DEFAULT_SOCK_DIR "\\\\.\\pipe\\FastCGI\\"
102 #else /* ! WIN32 */
104 #define DEFAULT_SOCK_DIR "/tmp/fcgi" /* Default dir for Unix/Domain sockets */
106 #endif /* ! WIN32 */
108 #define FCGI_MAGIC_TYPE "application/x-httpd-fcgi"
110 #if defined(PATH_MAX)
111 #define FCGI_MAXPATH PATH_MAX
112 #elif defined(MAXPATHLEN)
113 #define FCGI_MAXPATH MAXPATHLEN
114 #else
115 #define FCGI_MAXPATH 512
116 #endif
118 /* FCGI_REQUEST_COMPLETE_JOB is the longest: id, path, user, gid, qtime, start */
119 #define FCGI_MSG_CRAP 1 + 2 + MAX_USER_NAME_LEN + 1 + MAX_GID_CHAR_LEN + (2 * 11) + 3
121 #if defined(PIPE_BUF) && PIPE_BUF < FCGI_MAXPATH + FCGI_MSG_CRAP
122 #define FCGI_MAX_MSG_LEN PIPE_BUF
123 #undef FCGI_MAXPATH
124 #define FCGI_MAXPATH PIPE_BUF - FCGI_MSG_CRAP
125 #else
126 #define FCGI_MAX_MSG_LEN FCGI_MAXPATH + FCGI_MSG_CRAP
127 #endif
129 /* There is no way to reliably determiine the highest descriptor that can be
130 * assigned (UNP Vol1 Ed2 p337, and APUE p43) so we pick a number. */
131 #if (defined FD_SETSIZE) && (FD_SETSIZE > 1024)
132 #define FCGI_MAX_FD FD_SETSIZE
133 #else
134 #define FCGI_MAX_FD 1024
135 #endif
137 #ifndef SUN_LEN
138 #define SUN_LEN(sock) \
139 (sizeof(*(sock)) - sizeof((sock)->sun_path) + strlen((sock)->sun_path))
140 #endif
142 #if defined MAXLOGNAME && MAXLOGNAME > 15
143 #define MAX_USER_NAME_LEN MAXLOGNAME
144 #elif defined UT_NAMESIZE && UT_NAMESIZE > 15
145 #define MAX_USER_NAME_LEN UT_NAMESIZE
146 #else
147 #define MAX_USER_NAME_LEN 15 /* Max len of user name (suexec w/ ~user), */
148 #endif /* must accomodate uid printed as %ld too */
149 #define MAX_GID_CHAR_LEN 15 /* Max #chars in a gid printed as %ld */
151 #ifndef TRUE
152 #define TRUE (1)
153 #endif
155 #ifndef FALSE
156 #define FALSE (0)
157 #endif
159 #ifndef min
160 #define min(a,b) ((a) < (b) ? (a) : (b))
161 #endif
163 #ifndef max
164 #define max(a,b) ((a) > (b) ? (a) : (b))
165 #endif
167 /* This is (more or less) from http_main.c. It should be in an Apache header */
168 #ifndef SYS_SIGLIST
169 #define SYS_SIGLIST ap_sys_siglist
170 extern const char *ap_sys_siglist[];
171 #endif
173 #endif /* MOD_FASTCGI_H */