2 * $Id: fcgi.h,v 1.42 2002/09/22 16:49:34 robs Exp $
9 /* warning C4115: named type definition in parentheses */
10 #pragma warning(disable : 4115)
11 /* warning C4514: unreferenced inline function has been removed */
12 #pragma warning(disable:4514)
15 /* Apache header files */
17 #include "http_config.h"
18 #include "http_request.h"
19 #include "http_core.h"
20 #include "http_protocol.h"
21 #include "http_main.h"
23 #include "util_script.h"
26 /* AP2TODO there's probably a better way */
27 #ifdef STANDARD20_MODULE_STUFF
34 #include "ap_compat.h"
35 #include "apr_strings.h"
38 #if MODULE_MAGIC_NUMBER < 20020903
39 #error "mod_fastcgi is incompatible with Apache versions older than 2.0.41 under WIN"
43 typedef struct apr_array_header_t array_header
;
44 typedef struct apr_table_t table
;
45 typedef struct apr_pool_t pool
;
46 #define NET_SIZE_T apr_socklen_t
48 typedef apr_status_t apcb_t
;
49 #define APCB_OK APR_SUCCESS
51 #define XtOffsetOf APR_OFFSETOF
52 #define ap_select select
54 #define ap_user_id unixd_config.user_id
55 #define ap_group_id unixd_config.group_id
56 #define ap_user_name unixd_config.user_name
57 #define ap_suexec_enabled unixd_config.suexec_enabled
60 #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
64 #define ap_hard_timeout(a,b)
65 #define ap_kill_timeout(a)
66 #define ap_block_alarms()
67 #define ap_reset_timeout(a)
68 #define ap_unblock_alarms()
70 #if (defined(HAVE_WRITEV) && !HAVE_WRITEV && !defined(NO_WRITEV)) || defined WIN32
76 #include "http_conf_globals.h"
80 #if MODULE_MAGIC_NUMBER < 19990320
81 #error "This version of mod_fastcgi is incompatible with Apache versions older than 1.3.6."
92 #include "multithread.h"
94 #pragma warning(default : 4115)
99 /* FastCGI header files */
100 #include "mod_fastcgi.h"
101 /* @@@ This should go away when fcgi_protocol is re-written */
102 #include "fcgi_protocol.h"
105 int size
; /* size of entire buffer */
106 int length
; /* number of bytes in current buffer */
107 char *begin
; /* begining of valid data */
108 char *end
; /* end of valid data */
109 char data
[1]; /* buffer data */
116 #define MBOX_EVENT 0 /* mboc is ready to be read */
117 #define TERM_EVENT 1 /* termination event */
118 #define WAKE_EVENT 2 /* notification of child Fserver dieing */
120 typedef struct _fcgi_pm_job
{
126 unsigned long start_time
;
127 struct _fcgi_pm_job
*next
;
132 FCGI_RUNNING_STATE
, /* currently running */
133 FCGI_START_STATE
, /* needs to be started by PM */
134 FCGI_VICTIM_STATE
, /* SIGTERM was sent by PM */
135 FCGI_KILLED_STATE
, /* a wait() collected VICTIM */
136 FCGI_READY_STATE
/* empty cell, init state */
140 * ServerProcess holds data for each process associated with
141 * a class. It is embedded in fcgi_server below.
143 typedef struct _FcgiProcessInfo
{
145 HANDLE handle
; /* process handle */
146 HANDLE terminationEvent
; /* Event used to signal process termination */
148 pid_t pid
; /* pid of associated process */
149 enum process_state state
; /* state of the process */
150 time_t start_time
; /* time the process was started */
154 * fcgi_server holds info for each AppClass specified in this
155 * Web server's configuration.
157 typedef struct _FastCgiServerInfo
{
159 char *fs_path
; /* pathname of executable */
160 array_header
*pass_headers
; /* names of headers to pass in the env */
161 u_int idle_timeout
; /* fs idle secs allowed before aborting */
162 char **envp
; /* if NOT NULL, this is the env to send
163 * to the fcgi app when starting a server
165 u_int listenQueueDepth
; /* size of listen queue for IPC */
166 u_int appConnectTimeout
; /* timeout (sec) for connect() requests */
167 u_int numProcesses
; /* max allowed processes of this class,
168 * or for dynamic apps, the number of
169 * processes actually running */
170 time_t startTime
; /* the time the application was started */
171 time_t restartTime
; /* most recent time when the process
172 * manager started a process in this
174 int initStartDelay
; /* min number of seconds to wait between
175 * starting of AppClass processes at init */
176 u_int restartDelay
; /* number of seconds to wait between
177 * restarts after failure. Can be zero. */
178 int restartOnExit
; /* = TRUE = restart. else terminate/free */
179 u_int numFailures
; /* num restarts due to exit failure */
180 int bad
; /* is [not] having start problems */
181 struct sockaddr
*socket_addr
; /* Socket Address of FCGI app server class */
183 struct sockaddr
*dest_addr
; /* for local apps on NT need socket address */
184 /* bound to localhost */
185 const char *mutex_env_string
; /* string holding the accept mutex handle */
187 int socket_addr_len
; /* Length of socket */
188 enum {APP_CLASS_UNKNOWN
,
192 directive
; /* AppClass or ExternalAppClass */
193 const char *socket_path
; /* Name used to create a socket */
194 const char *host
; /* Hostname for externally managed
195 * FastCGI application processes */
196 unsigned short port
; /* Port number either for externally
197 * managed FastCGI applications or for
198 * server managed FastCGI applications,
199 * where server became application mngr. */
200 int listenFd
; /* Listener socket of FCGI app server
201 * class. Passed to app server process
202 * at process creation. */
203 u_int processPriority
; /* If locally server managed process,
204 * this is the priority to run the
205 * processes in this class at. */
206 struct _FcgiProcessInfo
*procs
; /* Pointer to array of
207 * processes belonging to this class. */
208 int keepConnection
; /* = 1 = maintain connection to app. */
209 uid_t uid
; /* uid this app should run as (suexec) */
210 gid_t gid
; /* gid this app should run as (suexec) */
211 const char *username
; /* suexec user arg */
212 const char *group
; /* suexec group arg, AND used in comm
213 * between RH and PM */
214 const char *user
; /* used in comm between RH and PM */
215 /* Dynamic FastCGI apps configuration parameters */
216 u_long totalConnTime
; /* microseconds spent by the web server
217 * waiting while fastcgi app performs
218 * request processing since the last
219 * dynamicUpdateInterval */
220 u_long smoothConnTime
; /* exponentially decayed values of the
221 * connection times. */
222 u_long totalQueueTime
; /* microseconds spent by the web server
223 * waiting to connect to the fastcgi app
224 * since the last dynamicUpdateInterval. */
225 struct _FastCgiServerInfo
*next
;
230 * fcgi_request holds the state of a particular FastCGI request.
236 int fd
; /* connection to FastCGI server */
238 int gotHeader
; /* TRUE if reading content bytes */
239 unsigned char packetType
; /* type of packet */
240 int dataLen
; /* length of data bytes */
241 int paddingLen
; /* record padding after content */
242 fcgi_server
*fs
; /* FastCGI server info */
243 const char *fs_path
; /* fcgi_server path */
244 Buffer
*serverInputBuffer
; /* input buffer from FastCgi server */
245 Buffer
*serverOutputBuffer
; /* output buffer to FastCgi server */
246 Buffer
*clientInputBuffer
; /* client input buffer */
247 Buffer
*clientOutputBuffer
; /* client output buffer */
248 table
*authHeaders
; /* headers received from an auth fs */
249 int auth_compat
; /* whether the auth request is spec compat */
250 table
*saved_subprocess_env
; /* subprocess_env before auth handling */
251 int expectingClientContent
; /* >0 => more content, <=0 => no more */
252 array_header
*header
;
255 int parseHeader
; /* TRUE iff parsing response headers */
257 int readingEndRequestBody
;
258 FCGI_EndRequestBody endRequestBody
;
262 unsigned int requestId
;
264 int role
; /* FastCGI Role: Authorizer or Responder */
265 int dynamic
; /* whether or not this is a dynamic app */
266 struct timeval startTime
; /* dynamic app's connect() attempt start time */
267 struct timeval queueTime
; /* dynamic app's connect() complete time */
268 struct timeval completeTime
; /* dynamic app's connection close() time */
269 int keepReadingFromFcgiApp
; /* still more to read from fcgi app? */
270 const char *user
; /* user used to invoke app (suexec) */
271 const char *group
; /* group used to invoke app (suexec) */
273 BOOL using_npipe_io
; /* named pipe io */
277 /* Values of parseHeader field */
278 #define SCAN_CGI_READING_HEADERS 1
279 #define SCAN_CGI_FINISHED 0
280 #define SCAN_CGI_BAD_HEADER -1
281 #define SCAN_CGI_INT_REDIRECT -2
282 #define SCAN_CGI_SRV_REDIRECT -3
284 /* Opcodes for Server->ProcMgr communication */
285 #define FCGI_SERVER_START_JOB 83 /* 'S' - start */
286 #define FCGI_SERVER_RESTART_JOB 82 /* 'R' - restart */
287 #define FCGI_REQUEST_TIMEOUT_JOB 84 /* 'T' - timeout */
288 #define FCGI_REQUEST_COMPLETE_JOB 67 /* 'C' - complete */
290 /* Authorizer types, for auth directives handling */
291 #define FCGI_AUTH_TYPE_AUTHENTICATOR 0
292 #define FCGI_AUTH_TYPE_AUTHORIZER 1
293 #define FCGI_AUTH_TYPE_ACCESS_CHECKER 2
295 /* Bits for auth_options */
296 #define FCGI_AUTHORITATIVE 1
297 #define FCGI_COMPAT 2
301 const char *authorizer
;
302 u_char authorizer_options
;
303 const char *authenticator
;
304 u_char authenticator_options
;
305 const char *access_checker
;
306 u_char access_checker_options
;
310 #define FCGI_FAILED 1
315 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(GetLastError())
316 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(GetLastError())
317 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(GetLastError())
318 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(GetLastError())
319 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(GetLastError())
320 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(GetLastError())
321 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(GetLastError())
322 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(GetLastError())
324 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
325 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
326 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
327 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
328 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
329 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
330 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
331 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
334 #define FCGI_LOG_EMERG_ERRNO __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
335 #define FCGI_LOG_ALERT_ERRNO __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
336 #define FCGI_LOG_CRIT_ERRNO __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
337 #define FCGI_LOG_ERR_ERRNO __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
338 #define FCGI_LOG_WARN_ERRNO __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
339 #define FCGI_LOG_NOTICE_ERRNO __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
340 #define FCGI_LOG_INFO_ERRNO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
341 #define FCGI_LOG_DEBUG_ERRNO __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
343 #define FCGI_LOG_EMERG_NOERRNO __FILE__,__LINE__,APLOG_EMERG,0
344 #define FCGI_LOG_ALERT_NOERRNO __FILE__,__LINE__,APLOG_ALERT,0
345 #define FCGI_LOG_CRIT_NOERRNO __FILE__,__LINE__,APLOG_CRIT,0
346 #define FCGI_LOG_ERR_NOERRNO __FILE__,__LINE__,APLOG_ERR,0
347 #define FCGI_LOG_WARN_NOERRNO __FILE__,__LINE__,APLOG_WARNING,0
348 #define FCGI_LOG_NOTICE_NOERRNO __FILE__,__LINE__,APLOG_NOTICE,0
349 #define FCGI_LOG_INFO_NOERRNO __FILE__,__LINE__,APLOG_INFO,0
350 #define FCGI_LOG_DEBUG_NOERRNO __FILE__,__LINE__,APLOG_DEBUG,0
355 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG|APLOG_WIN32ERROR
356 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT|APLOG_WIN32ERROR
357 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT|APLOG_WIN32ERROR
358 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR|APLOG_WIN32ERROR
359 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING|APLOG_WIN32ERROR
360 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE|APLOG_WIN32ERROR
361 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO|APLOG_WIN32ERROR
362 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG|APLOG_WIN32ERROR
364 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG
365 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT
366 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT
367 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR
368 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING
369 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE
370 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO
371 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG
374 #define FCGI_LOG_EMERG_ERRNO __FILE__,__LINE__,APLOG_EMERG /* system is unusable */
375 #define FCGI_LOG_ALERT_ERRNO __FILE__,__LINE__,APLOG_ALERT /* action must be taken immediately */
376 #define FCGI_LOG_CRIT_ERRNO __FILE__,__LINE__,APLOG_CRIT /* critical conditions */
377 #define FCGI_LOG_ERR_ERRNO __FILE__,__LINE__,APLOG_ERR /* error conditions */
378 #define FCGI_LOG_WARN_ERRNO __FILE__,__LINE__,APLOG_WARNING /* warning conditions */
379 #define FCGI_LOG_NOTICE_ERRNO __FILE__,__LINE__,APLOG_NOTICE /* normal but significant condition */
380 #define FCGI_LOG_INFO_ERRNO __FILE__,__LINE__,APLOG_INFO /* informational */
381 #define FCGI_LOG_DEBUG_ERRNO __FILE__,__LINE__,APLOG_DEBUG /* debug-level messages */
383 #define FCGI_LOG_EMERG_NOERRNO __FILE__,__LINE__,APLOG_EMERG|APLOG_NOERRNO
384 #define FCGI_LOG_ALERT_NOERRNO __FILE__,__LINE__,APLOG_ALERT|APLOG_NOERRNO
385 #define FCGI_LOG_CRIT_NOERRNO __FILE__,__LINE__,APLOG_CRIT|APLOG_NOERRNO
386 #define FCGI_LOG_ERR_NOERRNO __FILE__,__LINE__,APLOG_ERR|APLOG_NOERRNO
387 #define FCGI_LOG_WARN_NOERRNO __FILE__,__LINE__,APLOG_WARNING|APLOG_NOERRNO
388 #define FCGI_LOG_NOTICE_NOERRNO __FILE__,__LINE__,APLOG_NOTICE|APLOG_NOERRNO
389 #define FCGI_LOG_INFO_NOERRNO __FILE__,__LINE__,APLOG_INFO|APLOG_NOERRNO
390 #define FCGI_LOG_DEBUG_NOERRNO __FILE__,__LINE__,APLOG_DEBUG|APLOG_NOERRNO
392 #endif /* !APACHE2 */
395 #define FCGIDBG1(a) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a);
396 #define FCGIDBG2(a,b) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b);
397 #define FCGIDBG3(a,b,c) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c);
398 #define FCGIDBG4(a,b,c,d) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d);
399 #define FCGIDBG5(a,b,c,d,e) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d,e);
400 #define FCGIDBG6(a,b,c,d,e,f) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d,e,f);
401 #define FCGIDBG7(a,b,c,d,e,f,g) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d,e,f,g);
404 #define FCGIDBG2(a,b)
405 #define FCGIDBG3(a,b,c)
406 #define FCGIDBG4(a,b,c,d)
407 #define FCGIDBG5(a,b,c,d,e)
408 #define FCGIDBG6(a,b,c,d,e,f)
409 #define FCGIDBG7(a,b,c,d,e,f,g)
413 * Holds the status of the sending of the environment.
414 * A quick hack to dump the static vars for the NT port.
417 enum { PREP
, HEADER
, NAME
, VALUE
} pass
;
419 int headerLen
, nameLen
, valueLen
, totalLen
;
421 unsigned char headerBuff
[8];
427 void *fcgi_config_create_dir_config(pool
*p
, char *dummy
);
428 const char *fcgi_config_make_dir(pool
*tp
, char *path
);
429 const char *fcgi_config_make_dynamic_dir(pool
*p
, const int wax
);
430 const char *fcgi_config_new_static_server(cmd_parms
*cmd
, void *dummy
, const char *arg
);
431 const char *fcgi_config_new_external_server(cmd_parms
*cmd
, void *dummy
, const char *arg
);
432 const char *fcgi_config_set_config(cmd_parms
*cmd
, void *dummy
, const char *arg
);
433 const char *fcgi_config_set_fcgi_uid_n_gid(int set
);
435 const char *fcgi_config_new_auth_server(cmd_parms
* cmd
,
436 void *dir_config
, const char *fs_path
, const char * compat
);
438 const char *fcgi_config_set_authoritative_slot(cmd_parms
* cmd
,
439 void * dir_config
, int arg
);
440 const char *fcgi_config_set_socket_dir(cmd_parms
*cmd
, void *dummy
, const char *arg
);
441 const char *fcgi_config_set_wrapper(cmd_parms
*cmd
, void *dummy
, const char *arg
);
442 apcb_t
fcgi_config_reset_globals(void * dummy
);
443 const char *fcgi_config_set_env_var(pool
*p
, char **envp
, unsigned int *envc
, char * var
);
448 #if defined(WIN32) || defined(APACHE2)
449 void fcgi_pm_main(void *dummy
);
451 int fcgi_pm_main(void *dummy
, child_info
*info
);
457 void fcgi_protocol_queue_begin_request(fcgi_request
*fr
);
458 void fcgi_protocol_queue_client_buffer(fcgi_request
*fr
);
459 int fcgi_protocol_queue_env(request_rec
*r
, fcgi_request
*fr
, env_status
*env
);
460 int fcgi_protocol_dequeue(pool
*p
, fcgi_request
*fr
);
465 #define BufferLength(b) ((b)->length)
466 #define BufferFree(b) ((b)->size - (b)->length)
468 void fcgi_buf_check(Buffer
*bufPtr
);
469 void fcgi_buf_reset(Buffer
*bufPtr
);
470 Buffer
*fcgi_buf_new(pool
*p
, int size
);
471 void BufferDelete(Buffer
*bufPtr
);
477 int fcgi_buf_socket_recv(Buffer
*b
, SOCKET socket
);
478 int fcgi_buf_socket_send(Buffer
*b
, SOCKET socket
);
480 void fcgi_buf_added(Buffer
* const b
, const unsigned int len
);
481 void fcgi_buf_removed(Buffer
* const b
, unsigned int len
);
482 void fcgi_buf_get_block_info(Buffer
*bufPtr
, char **beginPtr
, int *countPtr
);
483 void fcgi_buf_toss(Buffer
*bufPtr
, int count
);
484 void fcgi_buf_get_free_block_info(Buffer
*bufPtr
, char **endPtr
, int *countPtr
);
485 void fcgi_buf_add_update(Buffer
*bufPtr
, int count
);
486 int fcgi_buf_add_block(Buffer
*bufPtr
, char *data
, int datalen
);
487 int fcgi_buf_add_string(Buffer
*bufPtr
, char *str
);
488 int fcgi_buf_get_to_block(Buffer
*bufPtr
, char *data
, int datalen
);
489 void fcgi_buf_get_to_buf(Buffer
*toPtr
, Buffer
*fromPtr
, int len
);
490 void fcgi_buf_get_to_array(Buffer
*buf
, array_header
*arr
, int len
);
496 char *fcgi_util_socket_hash_filename(pool
*p
, const char *path
,
497 const char *user
, const char *group
);
498 const char *fcgi_util_socket_make_path_absolute(pool
* const p
,
499 const char *const file
, const int dynamic
);
501 const char *fcgi_util_socket_make_domain_addr(pool
*p
, struct sockaddr_un
**socket_addr
,
502 int *socket_addr_len
, const char *socket_path
);
504 const char *fcgi_util_socket_make_inet_addr(pool
*p
, struct sockaddr_in
**socket_addr
,
505 int *socket_addr_len
, const char *host
, unsigned short port
);
506 const char *fcgi_util_check_access(pool
*tp
,
507 const char * const path
, const struct stat
*statBuf
,
508 const int mode
, const uid_t uid
, const gid_t gid
);
509 fcgi_server
*fcgi_util_fs_get_by_id(const char *ePath
, uid_t uid
, gid_t gid
);
510 fcgi_server
*fcgi_util_fs_get(const char *ePath
, const char *user
, const char *group
);
511 const char *fcgi_util_fs_is_path_ok(pool
* const p
, const char * const fs_path
, struct stat
*finfo
);
512 fcgi_server
*fcgi_util_fs_new(pool
*p
);
513 void fcgi_util_fs_add(fcgi_server
*s
);
514 const char *fcgi_util_fs_set_uid_n_gid(pool
*p
, fcgi_server
*s
, uid_t uid
, gid_t gid
);
515 ServerProcess
*fcgi_util_fs_create_procs(pool
*p
, int num
);
517 int fcgi_util_ticks(struct timeval
*);
520 int fcgi_pm_add_job(fcgi_pm_job
*new_job
);
523 uid_t
fcgi_util_get_server_uid(const server_rec
* const s
);
524 gid_t
fcgi_util_get_server_gid(const server_rec
* const s
);
530 extern pool
*fcgi_config_pool
;
532 extern server_rec
*fcgi_apache_main_server
;
534 extern const char *fcgi_wrapper
; /* wrapper path */
535 extern uid_t fcgi_user_id
; /* the run uid of Apache & PM */
536 extern gid_t fcgi_group_id
; /* the run gid of Apache & PM */
538 extern fcgi_server
*fcgi_servers
;
540 extern char *fcgi_socket_dir
; /* default FastCgiIpcDir */
542 /* pipe used for comm between the request handlers and the PM */
543 extern int fcgi_pm_pipe
[];
545 extern pid_t fcgi_pm_pid
;
547 extern char *fcgi_dynamic_dir
; /* directory for the dynamic
548 * fastcgi apps' sockets */
550 extern char *fcgi_empty_env
;
552 extern int fcgi_dynamic_total_proc_count
;
553 extern time_t fcgi_dynamic_epoch
;
554 extern time_t fcgi_dynamic_last_analyzed
;
557 extern HANDLE
*fcgi_dynamic_mbox_mutex
;
558 extern HANDLE fcgi_event_handles
[3];
559 extern fcgi_pm_job
*fcgi_dynamic_mbox
;
562 extern u_int dynamicMaxProcs
;
563 extern int dynamicMinProcs
;
564 extern int dynamicMaxClassProcs
;
565 extern u_int dynamicKillInterval
;
566 extern u_int dynamicUpdateInterval
;
567 extern float dynamicGain
;
568 extern int dynamicThreshold1
;
569 extern int dynamicThresholdN
;
570 extern u_int dynamicPleaseStartDelay
;
571 extern u_int dynamicAppConnectTimeout
;
572 extern char **dynamicEnvp
;
573 extern u_int dynamicProcessSlack
;
574 extern int dynamicAutoRestart
;
575 extern int dynamicAutoUpdate
;
576 extern u_int dynamicListenQueueDepth
;
577 extern u_int dynamicInitStartDelay
;
578 extern u_int dynamicRestartDelay
;
579 extern array_header
*dynamic_pass_headers
;
580 extern u_int dynamic_idle_timeout
;
581 extern int dynamicFlush
;
583 extern module MODULE_VAR_EXPORT fastcgi_module
;