Capture CreateFile()/GetLastError() in errno
[mod_fastcgi.git] / mod_fastcgi.h
blobcbd2d0b6350fda821aca9322c267917e4f698502
1 /*
2 * $Id: mod_fastcgi.h,v 1.24 2000/05/10 05:21:10 robs Exp $
3 */
5 #ifndef MOD_FASTCGI_H
6 #define MOD_FASTCGI_H
8 #define MOD_FASTCGI_VERSION "2.2.5"
11 * # of idle seconds allowed to pass while connected to a FastCGI before aborting
13 #define FCGI_DEFAULT_IDLE_TIMEOUT 30
15 #define FCGI_DEFAULT_LISTEN_Q 100 /* listen queue (backlog) depth */
16 #define FCGI_DEFAULT_RESTART_DELAY 5 /* delay between restarts */
17 #define DEFAULT_INIT_START_DELAY 1 /* delay between starts */
18 #define FCGI_DEFAULT_PRIORITY 0 /* process priority - not used */
19 #define FCGI_ERRMSG_LEN 200 /* size of error buffer */
20 #define FCGI_MIN_EXEC_RETRY_DELAY 10 /* minimum number of seconds to
21 wait before restarting */
22 #define MAX_INIT_ENV_VARS 64 /* max # of -initial-env options */
24 /* max number of chars in a line of stderr we can handle from a FastCGI Server */
25 #define FCGI_SERVER_MAX_STDERR_LINE_LEN 1023
27 /* size of the buffer the PM uses to read records from the request handlers */
28 #define FCGI_MSGS_BUFSIZE 32 * 512
30 #define SERVER_BUFSIZE 8192
32 /* Dynamic FastCGI applications */
33 #define FCGI_DEFAULT_MAX_PROCS 50 /* maximum number of processes that
34 * are allowed to run on system */
35 #define FCGI_DEFAULT_MIN_PROCS 5 /* minimum number of processes that
36 * can be run without being killed
37 * off by the process manager */
38 #define FCGI_DEFAULT_MAX_CLASS_PROCS 10 /* maximum number of processes that
39 * are allowed to run for a single
40 * application class */
41 #define FCGI_DEFAULT_KILL_INTERVAL 300 /* number of seconds in which we
42 * should execute the kill policy
43 * by killing off extra instances */
44 #define FCGI_DEFAULT_UPDATE_INTERVAL 300 /* number of seconds in which we
45 * should recalculate the value of
46 * totalConnTime variable */
47 #define FCGI_DEFAULT_GAIN 0.5 /* value used as an exponent in the
48 * calculation of the exponentially
49 * decayed connection times;
50 * old values are scaled by
51 * (1-dynamicGain), so making it
52 * smaller weights them more heavily
53 * compared to the current value,
54 * which is scaled by dynamicGain */
55 #define FCGI_DEFAULT_THRESHHOLD_1 0 /* if load falls below this value
56 * and we have only one instance
57 * running, it is killed off */
58 #define FCGI_DEFAULT_THRESHHOLD_N 50 /* if load falls below this value
59 * and we have more than one
60 * instances, one is killed off */
61 #define FCGI_DEFAULT_START_PROCESS_DELAY 3 /* specifies the maximum number of
62 * seconds a server should wait in
63 * attempt to connect to fcgi app
64 * before sending CONN_TIMEOUT */
67 * # of sec to wait in a non-blocking connect() to the FastCGI application
68 * before aborting the request, or 0 to indicate that blocking connect()s
69 * should be used. Non-blocking connect()s are problematic on many platforms.
71 #define FCGI_DEFAULT_APP_CONN_TIMEOUT 0
73 #define FCGI_DEFAULT_PROCESS_SLACK 5 /* if this number combined with the
74 * number of the currently running
75 * processes exceeds dynamicMaxProcs, then
76 * the KillDynamicProcs() is invoked */
77 #define FCGI_DEFAULT_RESTART_DYNAMIC 0 /* Do not restart dynamic processes */
78 #define FCGI_DEFAULT_AUTOUPDATE 0 /* do not automatically restart
79 * fcgi apps when the binary on the
80 * disk is changed. */
82 #ifdef WIN32
83 #define DEFAULT_SOCK_DIR "\\\\.\\pipe\\FastCGI\\"
84 #else
85 #define DEFAULT_SOCK_DIR "/tmp/fcgi" /* Default dir for Unix/Domain sockets */
86 #endif
88 #define FCGI_MAGIC_TYPE "application/x-httpd-fcgi"
90 #if defined(PATH_MAX)
91 #define FCGI_MAXPATH PATH_MAX
92 #elif defined(MAXPATHLEN)
93 #define FCGI_MAXPATH MAXPATHLEN
94 #else
95 #define FCGI_MAXPATH 512
96 #endif
98 /* REQ_COMPLETE is the longest: id, path, user, gid, qtime, start */
99 #define FCGI_MSG_CRAP 1 + 2 + MAX_USER_NAME_LEN + 1 + MAX_GID_CHAR_LEN + (2 * 11) + 3
101 #if defined(PIPE_BUF) && PIPE_BUF < FCGI_MAXPATH + FCGI_MSG_CRAP
102 #define FCGI_MAX_MSG_LEN PIPE_BUF
103 #undef FCGI_MAXPATH
104 #define FCGI_MAXPATH PIPE_BUF - FCGI_MSG_CRAP
105 #else
106 #define FCGI_MAX_MSG_LEN FCGI_MAXPATH + FCGI_MSG_CRAP
107 #endif
109 #ifdef OPEN_MAX
110 #define MAX_OPEN_FDS OPEN_MAX
111 #else
112 #define MAX_OPEN_FDS (128)
113 #endif
115 #ifndef SUN_LEN
116 #define SUN_LEN(sock) \
117 (sizeof(*(sock)) - sizeof((sock)->sun_path) + strlen((sock)->sun_path))
118 #endif
120 #if defined MAXLOGNAME && MAXLOGNAME > 15
121 #define MAX_USER_NAME_LEN MAXLOGNAME
122 #elif defined UT_NAMESIZE && UT_NAMESIZE > 15
123 #define MAX_USER_NAME_LEN UT_NAMESIZE
124 #else
125 #define MAX_USER_NAME_LEN 15 /* Max len of user name (suexec w/ ~user), */
126 #endif /* must accomodate uid printed as %ld too */
127 #define MAX_GID_CHAR_LEN 15 /* Max #chars in a gid printed as %ld */
129 #ifndef TRUE
130 #define TRUE (1)
131 #endif
133 #ifndef FALSE
134 #define FALSE (0)
135 #endif
137 #ifndef min
138 #define min(a,b) ((a) < (b) ? (a) : (b))
139 #endif
141 #ifndef max
142 #define max(a,b) ((a) > (b) ? (a) : (b))
143 #endif
145 /* This is (more or less) from http_main.c. It should be in an Apache header */
146 #ifndef SYS_SIGLIST
147 #define SYS_SIGLIST ap_sys_siglist
148 extern const char *ap_sys_siglist[];
149 #endif
151 #endif /* MOD_FASTCGI_H */