2 * $Id: fcgi.h,v 1.45 2004/01/07 01:56:00 robs Exp $
8 #if defined(DEBUG) && ! defined(NDEBUG)
9 #define ASSERT(a) ap_assert(a)
11 #define ASSERT(a) ((void) 0)
15 /* warning C4115: named type definition in parentheses */
16 #pragma warning(disable : 4115)
17 /* warning C4514: unreferenced inline function has been removed */
18 #pragma warning(disable:4514)
21 /* Apache header files */
23 #include "http_config.h"
24 #include "http_request.h"
25 #include "http_core.h"
26 #include "http_protocol.h"
27 #include "http_main.h"
29 #include "util_script.h"
32 /* AP2TODO there's probably a better way */
33 #ifdef STANDARD20_MODULE_STUFF
40 #include "ap_compat.h"
41 #include "apr_strings.h"
44 #if MODULE_MAGIC_NUMBER < 20020903
45 #error "mod_fastcgi is incompatible with Apache versions older than 2.0.41 under WIN"
49 typedef struct apr_array_header_t array_header
;
50 typedef struct apr_table_t table
;
51 typedef struct apr_pool_t pool
;
52 #define NET_SIZE_T apr_socklen_t
54 typedef apr_status_t apcb_t
;
55 #define APCB_OK APR_SUCCESS
57 #define XtOffsetOf APR_OFFSETOF
58 #define ap_select select
60 #define ap_user_id unixd_config.user_id
61 #define ap_group_id unixd_config.group_id
62 #define ap_user_name unixd_config.user_name
63 #define ap_suexec_enabled unixd_config.suexec_enabled
66 #define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
70 #define ap_hard_timeout(a,b)
71 #define ap_kill_timeout(a)
72 #define ap_block_alarms()
73 #define ap_reset_timeout(a)
74 #define ap_unblock_alarms()
76 #if (defined(HAVE_WRITEV) && !HAVE_WRITEV && !defined(NO_WRITEV)) || defined WIN32
82 #include "http_conf_globals.h"
86 #if MODULE_MAGIC_NUMBER < 19990320
87 #error "This version of mod_fastcgi is incompatible with Apache versions older than 1.3.6."
98 #include "multithread.h"
100 #pragma warning(default : 4115)
105 /* FastCGI header files */
106 #include "mod_fastcgi.h"
107 /* @@@ This should go away when fcgi_protocol is re-written */
108 #include "fcgi_protocol.h"
111 int size
; /* size of entire buffer */
112 int length
; /* number of bytes in current buffer */
113 char *begin
; /* begining of valid data */
114 char *end
; /* end of valid data */
115 char data
[1]; /* buffer data */
122 #define MBOX_EVENT 0 /* mboc is ready to be read */
123 #define TERM_EVENT 1 /* termination event */
124 #define WAKE_EVENT 2 /* notification of child Fserver dieing */
126 typedef struct _fcgi_pm_job
{
132 unsigned long start_time
;
133 struct _fcgi_pm_job
*next
;
138 FCGI_RUNNING_STATE
, /* currently running */
139 FCGI_START_STATE
, /* needs to be started by PM */
140 FCGI_VICTIM_STATE
, /* SIGTERM was sent by PM */
141 FCGI_KILLED_STATE
, /* a wait() collected VICTIM */
142 FCGI_READY_STATE
/* empty cell, init state */
146 * ServerProcess holds data for each process associated with
147 * a class. It is embedded in fcgi_server below.
149 typedef struct _FcgiProcessInfo
{
151 HANDLE handle
; /* process handle */
152 HANDLE terminationEvent
; /* Event used to signal process termination */
154 pid_t pid
; /* pid of associated process */
155 enum process_state state
; /* state of the process */
156 time_t start_time
; /* time the process was started */
160 * fcgi_server holds info for each AppClass specified in this
161 * Web server's configuration.
163 typedef struct _FastCgiServerInfo
{
165 char *fs_path
; /* pathname of executable */
166 array_header
*pass_headers
; /* names of headers to pass in the env */
167 u_int idle_timeout
; /* fs idle secs allowed before aborting */
168 char **envp
; /* if NOT NULL, this is the env to send
169 * to the fcgi app when starting a server
171 u_int listenQueueDepth
; /* size of listen queue for IPC */
172 u_int appConnectTimeout
; /* timeout (sec) for connect() requests */
173 u_int numProcesses
; /* max allowed processes of this class,
174 * or for dynamic apps, the number of
175 * processes actually running */
176 time_t startTime
; /* the time the application was started */
177 time_t restartTime
; /* most recent time when the process
178 * manager started a process in this
180 int initStartDelay
; /* min number of seconds to wait between
181 * starting of AppClass processes at init */
182 u_int restartDelay
; /* number of seconds to wait between
183 * restarts after failure. Can be zero. */
184 u_int minServerLife
; /* minimum number of seconds a server must
185 * live before it's considered borked. */
186 int restartOnExit
; /* = TRUE = restart. else terminate/free */
187 u_int numFailures
; /* num restarts due to exit failure */
188 int bad
; /* is [not] having start problems */
189 struct sockaddr
*socket_addr
; /* Socket Address of FCGI app server class */
191 struct sockaddr
*dest_addr
; /* for local apps on NT need socket address */
192 /* bound to localhost */
193 const char *mutex_env_string
; /* string holding the accept mutex handle */
195 int socket_addr_len
; /* Length of socket */
196 enum {APP_CLASS_UNKNOWN
,
200 directive
; /* AppClass or ExternalAppClass */
201 const char *socket_path
; /* Name used to create a socket */
202 const char *host
; /* Hostname for externally managed
203 * FastCGI application processes */
204 unsigned short port
; /* Port number either for externally
205 * managed FastCGI applications or for
206 * server managed FastCGI applications,
207 * where server became application mngr. */
208 int listenFd
; /* Listener socket of FCGI app server
209 * class. Passed to app server process
210 * at process creation. */
211 u_int processPriority
; /* If locally server managed process,
212 * this is the priority to run the
213 * processes in this class at. */
214 struct _FcgiProcessInfo
*procs
; /* Pointer to array of
215 * processes belonging to this class. */
216 int keepConnection
; /* = 1 = maintain connection to app. */
217 uid_t uid
; /* uid this app should run as (suexec) */
218 gid_t gid
; /* gid this app should run as (suexec) */
219 const char *username
; /* suexec user arg */
220 const char *group
; /* suexec group arg, AND used in comm
221 * between RH and PM */
222 const char *user
; /* used in comm between RH and PM */
223 /* Dynamic FastCGI apps configuration parameters */
224 u_long totalConnTime
; /* microseconds spent by the web server
225 * waiting while fastcgi app performs
226 * request processing since the last
227 * dynamicUpdateInterval */
228 u_long smoothConnTime
; /* exponentially decayed values of the
229 * connection times. */
230 u_long totalQueueTime
; /* microseconds spent by the web server
231 * waiting to connect to the fastcgi app
232 * since the last dynamicUpdateInterval. */
233 struct _FastCgiServerInfo
*next
;
238 * fcgi_request holds the state of a particular FastCGI request.
244 int fd
; /* connection to FastCGI server */
246 int gotHeader
; /* TRUE if reading content bytes */
247 unsigned char packetType
; /* type of packet */
248 int dataLen
; /* length of data bytes */
249 int paddingLen
; /* record padding after content */
250 fcgi_server
*fs
; /* FastCGI server info */
251 const char *fs_path
; /* fcgi_server path */
252 Buffer
*serverInputBuffer
; /* input buffer from FastCgi server */
253 Buffer
*serverOutputBuffer
; /* output buffer to FastCgi server */
254 Buffer
*clientInputBuffer
; /* client input buffer */
255 Buffer
*clientOutputBuffer
; /* client output buffer */
256 table
*authHeaders
; /* headers received from an auth fs */
257 int auth_compat
; /* whether the auth request is spec compat */
258 table
*saved_subprocess_env
; /* subprocess_env before auth handling */
259 int expectingClientContent
; /* >0 => more content, <=0 => no more */
260 array_header
*header
;
263 int parseHeader
; /* TRUE iff parsing response headers */
265 int readingEndRequestBody
;
266 FCGI_EndRequestBody endRequestBody
;
270 unsigned int requestId
;
272 int role
; /* FastCGI Role: Authorizer or Responder */
273 int dynamic
; /* whether or not this is a dynamic app */
274 struct timeval startTime
; /* dynamic app's connect() attempt start time */
275 struct timeval queueTime
; /* dynamic app's connect() complete time */
276 struct timeval completeTime
; /* dynamic app's connection close() time */
277 int keepReadingFromFcgiApp
; /* still more to read from fcgi app? */
278 const char *user
; /* user used to invoke app (suexec) */
279 const char *group
; /* group used to invoke app (suexec) */
281 BOOL using_npipe_io
; /* named pipe io */
285 /* Values of parseHeader field */
286 #define SCAN_CGI_READING_HEADERS 1
287 #define SCAN_CGI_FINISHED 0
288 #define SCAN_CGI_BAD_HEADER -1
289 #define SCAN_CGI_INT_REDIRECT -2
290 #define SCAN_CGI_SRV_REDIRECT -3
292 /* Opcodes for Server->ProcMgr communication */
293 #define FCGI_SERVER_START_JOB 83 /* 'S' - start */
294 #define FCGI_SERVER_RESTART_JOB 82 /* 'R' - restart */
295 #define FCGI_REQUEST_TIMEOUT_JOB 84 /* 'T' - timeout */
296 #define FCGI_REQUEST_COMPLETE_JOB 67 /* 'C' - complete */
298 /* Authorizer types, for auth directives handling */
299 #define FCGI_AUTH_TYPE_AUTHENTICATOR 0
300 #define FCGI_AUTH_TYPE_AUTHORIZER 1
301 #define FCGI_AUTH_TYPE_ACCESS_CHECKER 2
303 /* Bits for auth_options */
304 #define FCGI_AUTHORITATIVE 1
305 #define FCGI_COMPAT 2
309 const char *authorizer
;
310 u_char authorizer_options
;
311 const char *authenticator
;
312 u_char authenticator_options
;
313 const char *access_checker
;
314 u_char access_checker_options
;
318 #define FCGI_FAILED 1
323 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(GetLastError())
324 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(GetLastError())
325 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(GetLastError())
326 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(GetLastError())
327 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(GetLastError())
328 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(GetLastError())
329 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(GetLastError())
330 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(GetLastError())
332 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
333 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
334 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
335 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
336 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
337 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
338 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
339 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
342 #define FCGI_LOG_EMERG_ERRNO __FILE__,__LINE__,APLOG_EMERG,APR_FROM_OS_ERROR(errno)
343 #define FCGI_LOG_ALERT_ERRNO __FILE__,__LINE__,APLOG_ALERT,APR_FROM_OS_ERROR(errno)
344 #define FCGI_LOG_CRIT_ERRNO __FILE__,__LINE__,APLOG_CRIT,APR_FROM_OS_ERROR(errno)
345 #define FCGI_LOG_ERR_ERRNO __FILE__,__LINE__,APLOG_ERR,APR_FROM_OS_ERROR(errno)
346 #define FCGI_LOG_WARN_ERRNO __FILE__,__LINE__,APLOG_WARNING,APR_FROM_OS_ERROR(errno)
347 #define FCGI_LOG_NOTICE_ERRNO __FILE__,__LINE__,APLOG_NOTICE,APR_FROM_OS_ERROR(errno)
348 #define FCGI_LOG_INFO_ERRNO __FILE__,__LINE__,APLOG_INFO,APR_FROM_OS_ERROR(errno)
349 #define FCGI_LOG_DEBUG_ERRNO __FILE__,__LINE__,APLOG_DEBUG,APR_FROM_OS_ERROR(errno)
351 #define FCGI_LOG_EMERG_NOERRNO __FILE__,__LINE__,APLOG_EMERG,0
352 #define FCGI_LOG_ALERT_NOERRNO __FILE__,__LINE__,APLOG_ALERT,0
353 #define FCGI_LOG_CRIT_NOERRNO __FILE__,__LINE__,APLOG_CRIT,0
354 #define FCGI_LOG_ERR_NOERRNO __FILE__,__LINE__,APLOG_ERR,0
355 #define FCGI_LOG_WARN_NOERRNO __FILE__,__LINE__,APLOG_WARNING,0
356 #define FCGI_LOG_NOTICE_NOERRNO __FILE__,__LINE__,APLOG_NOTICE,0
357 #define FCGI_LOG_INFO_NOERRNO __FILE__,__LINE__,APLOG_INFO,0
358 #define FCGI_LOG_DEBUG_NOERRNO __FILE__,__LINE__,APLOG_DEBUG,0
363 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG|APLOG_WIN32ERROR
364 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT|APLOG_WIN32ERROR
365 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT|APLOG_WIN32ERROR
366 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR|APLOG_WIN32ERROR
367 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING|APLOG_WIN32ERROR
368 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE|APLOG_WIN32ERROR
369 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO|APLOG_WIN32ERROR
370 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG|APLOG_WIN32ERROR
372 #define FCGI_LOG_EMERG __FILE__,__LINE__,APLOG_EMERG
373 #define FCGI_LOG_ALERT __FILE__,__LINE__,APLOG_ALERT
374 #define FCGI_LOG_CRIT __FILE__,__LINE__,APLOG_CRIT
375 #define FCGI_LOG_ERR __FILE__,__LINE__,APLOG_ERR
376 #define FCGI_LOG_WARN __FILE__,__LINE__,APLOG_WARNING
377 #define FCGI_LOG_NOTICE __FILE__,__LINE__,APLOG_NOTICE
378 #define FCGI_LOG_INFO __FILE__,__LINE__,APLOG_INFO
379 #define FCGI_LOG_DEBUG __FILE__,__LINE__,APLOG_DEBUG
382 #define FCGI_LOG_EMERG_ERRNO __FILE__,__LINE__,APLOG_EMERG /* system is unusable */
383 #define FCGI_LOG_ALERT_ERRNO __FILE__,__LINE__,APLOG_ALERT /* action must be taken immediately */
384 #define FCGI_LOG_CRIT_ERRNO __FILE__,__LINE__,APLOG_CRIT /* critical conditions */
385 #define FCGI_LOG_ERR_ERRNO __FILE__,__LINE__,APLOG_ERR /* error conditions */
386 #define FCGI_LOG_WARN_ERRNO __FILE__,__LINE__,APLOG_WARNING /* warning conditions */
387 #define FCGI_LOG_NOTICE_ERRNO __FILE__,__LINE__,APLOG_NOTICE /* normal but significant condition */
388 #define FCGI_LOG_INFO_ERRNO __FILE__,__LINE__,APLOG_INFO /* informational */
389 #define FCGI_LOG_DEBUG_ERRNO __FILE__,__LINE__,APLOG_DEBUG /* debug-level messages */
391 #define FCGI_LOG_EMERG_NOERRNO __FILE__,__LINE__,APLOG_EMERG|APLOG_NOERRNO
392 #define FCGI_LOG_ALERT_NOERRNO __FILE__,__LINE__,APLOG_ALERT|APLOG_NOERRNO
393 #define FCGI_LOG_CRIT_NOERRNO __FILE__,__LINE__,APLOG_CRIT|APLOG_NOERRNO
394 #define FCGI_LOG_ERR_NOERRNO __FILE__,__LINE__,APLOG_ERR|APLOG_NOERRNO
395 #define FCGI_LOG_WARN_NOERRNO __FILE__,__LINE__,APLOG_WARNING|APLOG_NOERRNO
396 #define FCGI_LOG_NOTICE_NOERRNO __FILE__,__LINE__,APLOG_NOTICE|APLOG_NOERRNO
397 #define FCGI_LOG_INFO_NOERRNO __FILE__,__LINE__,APLOG_INFO|APLOG_NOERRNO
398 #define FCGI_LOG_DEBUG_NOERRNO __FILE__,__LINE__,APLOG_DEBUG|APLOG_NOERRNO
400 #endif /* !APACHE2 */
403 #define FCGIDBG1(a) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a);
404 #define FCGIDBG2(a,b) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b);
405 #define FCGIDBG3(a,b,c) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c);
406 #define FCGIDBG4(a,b,c,d) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d);
407 #define FCGIDBG5(a,b,c,d,e) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d,e);
408 #define FCGIDBG6(a,b,c,d,e,f) ap_log_error(FCGI_LOG_DEBUG,fcgi_apache_main_server,a,b,c,d,e,f);
409 #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);
412 #define FCGIDBG2(a,b)
413 #define FCGIDBG3(a,b,c)
414 #define FCGIDBG4(a,b,c,d)
415 #define FCGIDBG5(a,b,c,d,e)
416 #define FCGIDBG6(a,b,c,d,e,f)
417 #define FCGIDBG7(a,b,c,d,e,f,g)
421 * Holds the status of the sending of the environment.
422 * A quick hack to dump the static vars for the NT port.
425 enum { PREP
, HEADER
, NAME
, VALUE
} pass
;
427 int headerLen
, nameLen
, valueLen
, totalLen
;
429 unsigned char headerBuff
[8];
435 void *fcgi_config_create_dir_config(pool
*p
, char *dummy
);
436 const char *fcgi_config_make_dir(pool
*tp
, char *path
);
437 const char *fcgi_config_make_dynamic_dir(pool
*p
, const int wax
);
438 const char *fcgi_config_new_static_server(cmd_parms
*cmd
, void *dummy
, const char *arg
);
439 const char *fcgi_config_new_external_server(cmd_parms
*cmd
, void *dummy
, const char *arg
);
440 const char *fcgi_config_set_config(cmd_parms
*cmd
, void *dummy
, const char *arg
);
441 const char *fcgi_config_set_fcgi_uid_n_gid(int set
);
443 const char *fcgi_config_new_auth_server(cmd_parms
* cmd
,
444 void *dir_config
, const char *fs_path
, const char * compat
);
446 const char *fcgi_config_set_authoritative_slot(cmd_parms
* cmd
,
447 void * dir_config
, int arg
);
448 const char *fcgi_config_set_socket_dir(cmd_parms
*cmd
, void *dummy
, const char *arg
);
449 const char *fcgi_config_set_wrapper(cmd_parms
*cmd
, void *dummy
, const char *arg
);
450 apcb_t
fcgi_config_reset_globals(void * dummy
);
451 const char *fcgi_config_set_env_var(pool
*p
, char **envp
, unsigned int *envc
, char * var
);
456 #if defined(WIN32) || defined(APACHE2)
457 void fcgi_pm_main(void *dummy
);
459 int fcgi_pm_main(void *dummy
, child_info
*info
);
465 void fcgi_protocol_queue_begin_request(fcgi_request
*fr
);
466 void fcgi_protocol_queue_client_buffer(fcgi_request
*fr
);
467 int fcgi_protocol_queue_env(request_rec
*r
, fcgi_request
*fr
, env_status
*env
);
468 int fcgi_protocol_dequeue(pool
*p
, fcgi_request
*fr
);
473 #define BufferLength(b) ((b)->length)
474 #define BufferFree(b) ((b)->size - (b)->length)
476 void fcgi_buf_reset(Buffer
*bufPtr
);
477 Buffer
*fcgi_buf_new(pool
*p
, int size
);
483 int fcgi_buf_socket_recv(Buffer
*b
, SOCKET socket
);
484 int fcgi_buf_socket_send(Buffer
*b
, SOCKET socket
);
486 void fcgi_buf_added(Buffer
* const b
, const unsigned int len
);
487 void fcgi_buf_removed(Buffer
* const b
, unsigned int len
);
488 void fcgi_buf_get_block_info(Buffer
*bufPtr
, char **beginPtr
, int *countPtr
);
489 void fcgi_buf_toss(Buffer
*bufPtr
, int count
);
490 void fcgi_buf_get_free_block_info(Buffer
*bufPtr
, char **endPtr
, int *countPtr
);
491 void fcgi_buf_add_update(Buffer
*bufPtr
, int count
);
492 int fcgi_buf_add_block(Buffer
*bufPtr
, char *data
, int datalen
);
493 int fcgi_buf_add_string(Buffer
*bufPtr
, char *str
);
494 int fcgi_buf_get_to_block(Buffer
*bufPtr
, char *data
, int datalen
);
495 void fcgi_buf_get_to_buf(Buffer
*toPtr
, Buffer
*fromPtr
, int len
);
496 void fcgi_buf_get_to_array(Buffer
*buf
, array_header
*arr
, int len
);
502 char *fcgi_util_socket_hash_filename(pool
*p
, const char *path
,
503 const char *user
, const char *group
);
504 const char *fcgi_util_socket_make_path_absolute(pool
* const p
,
505 const char *const file
, const int dynamic
);
507 const char *fcgi_util_socket_make_domain_addr(pool
*p
, struct sockaddr_un
**socket_addr
,
508 int *socket_addr_len
, const char *socket_path
);
510 const char *fcgi_util_socket_make_inet_addr(pool
*p
, struct sockaddr_in
**socket_addr
,
511 int *socket_addr_len
, const char *host
, unsigned short port
);
512 const char *fcgi_util_check_access(pool
*tp
,
513 const char * const path
, const struct stat
*statBuf
,
514 const int mode
, const uid_t uid
, const gid_t gid
);
515 fcgi_server
*fcgi_util_fs_get_by_id(const char *ePath
, uid_t uid
, gid_t gid
);
516 fcgi_server
*fcgi_util_fs_get(const char *ePath
, const char *user
, const char *group
);
517 const char *fcgi_util_fs_is_path_ok(pool
* const p
, const char * const fs_path
, struct stat
*finfo
);
518 fcgi_server
*fcgi_util_fs_new(pool
*p
);
519 void fcgi_util_fs_add(fcgi_server
*s
);
520 const char *fcgi_util_fs_set_uid_n_gid(pool
*p
, fcgi_server
*s
, uid_t uid
, gid_t gid
);
521 ServerProcess
*fcgi_util_fs_create_procs(pool
*p
, int num
);
523 int fcgi_util_ticks(struct timeval
*);
526 int fcgi_pm_add_job(fcgi_pm_job
*new_job
);
529 uid_t
fcgi_util_get_server_uid(const server_rec
* const s
);
530 gid_t
fcgi_util_get_server_gid(const server_rec
* const s
);
536 extern pool
*fcgi_config_pool
;
538 extern server_rec
*fcgi_apache_main_server
;
540 extern const char *fcgi_wrapper
; /* wrapper path */
541 extern uid_t fcgi_user_id
; /* the run uid of Apache & PM */
542 extern gid_t fcgi_group_id
; /* the run gid of Apache & PM */
544 extern fcgi_server
*fcgi_servers
;
546 extern char *fcgi_socket_dir
; /* default FastCgiIpcDir */
548 /* pipe used for comm between the request handlers and the PM */
549 extern int fcgi_pm_pipe
[];
551 extern pid_t fcgi_pm_pid
;
553 extern char *fcgi_dynamic_dir
; /* directory for the dynamic
554 * fastcgi apps' sockets */
556 extern char *fcgi_empty_env
;
558 extern int fcgi_dynamic_total_proc_count
;
559 extern time_t fcgi_dynamic_epoch
;
560 extern time_t fcgi_dynamic_last_analyzed
;
563 extern HANDLE
*fcgi_dynamic_mbox_mutex
;
564 extern HANDLE fcgi_event_handles
[3];
565 extern fcgi_pm_job
*fcgi_dynamic_mbox
;
568 extern u_int dynamicMaxProcs
;
569 extern int dynamicMinProcs
;
570 extern int dynamicMaxClassProcs
;
571 extern u_int dynamicKillInterval
;
572 extern u_int dynamicUpdateInterval
;
573 extern float dynamicGain
;
574 extern int dynamicThreshold1
;
575 extern int dynamicThresholdN
;
576 extern u_int dynamicPleaseStartDelay
;
577 extern u_int dynamicAppConnectTimeout
;
578 extern char **dynamicEnvp
;
579 extern u_int dynamicProcessSlack
;
580 extern int dynamicAutoRestart
;
581 extern int dynamicAutoUpdate
;
582 extern u_int dynamicListenQueueDepth
;
583 extern u_int dynamicInitStartDelay
;
584 extern u_int dynamicRestartDelay
;
585 extern array_header
*dynamic_pass_headers
;
586 extern u_int dynamic_idle_timeout
;
587 extern int dynamicMinServerLife
;
588 extern int dynamicFlush
;
591 extern module MODULE_VAR_EXPORT fastcgi_module
;