cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
dgaudet 97/06/28 16:05:17 Modified:src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h Log: Implement a LockFile directive to move the lockfile to a different location. Submitted by: Jim and Dean Revision ChangesPath 1.11 +1 -0 apache/src/http_conf_globals.h Index: http_conf_globals.h === RCS file: /export/home/cvs/apache/src/http_conf_globals.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C3 -r1.10 -r1.11 *** http_conf_globals.h 1997/06/15 19:22:25 1.10 --- http_conf_globals.h 1997/06/28 23:05:13 1.11 *** *** 74,79 --- 74,80 extern char *pid_fname; extern char *scoreboard_fname; + extern char *lock_fname; extern char *server_argv0; /* Trying to allocate these in the config pool gets us into some *nasty* 1.52 +1 -0 apache/src/http_config.c Index: http_config.c === RCS file: /export/home/cvs/apache/src/http_config.c,v retrieving revision 1.51 retrieving revision 1.52 diff -C3 -r1.51 -r1.52 *** http_config.c 1997/06/28 22:12:53 1.51 --- http_config.c 1997/06/28 23:05:13 1.52 *** *** 1040,1045 --- 1040,1046 daemons_limit = HARD_SERVER_LIMIT; pid_fname = DEFAULT_PIDLOG; scoreboard_fname = DEFAULT_SCOREBOARD; + lock_fname = DEFAULT_LOCKFILE; max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; bind_address.s_addr = htonl(INADDR_ANY); listeners = NULL; 1.86 +7 -0 apache/src/http_core.c Index: http_core.c === RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.85 retrieving revision 1.86 diff -C3 -r1.85 -r1.86 *** http_core.c 1997/06/28 20:10:12 1.85 --- http_core.c 1997/06/28 23:05:13 1.86 *** *** 970,975 --- 970,980 return NULL; } + const char *set_lockfile (cmd_parms *cmd, void *dummy, char *arg) { + lock_fname = pstrdup (cmd->pool, arg); + return NULL; + } + const char *set_idcheck (cmd_parms *cmd, core_dir_config *d, int arg) { d->do_rfc1413 = arg; return NULL; *** *** 1230,1235 --- 1235,1242 "A file for logging the server process ID"}, { "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, "A file for Apache to maintain runtime process management information"}, + { "LockFile", set_lockfile, NULL, RSRC_CONF, TAKE1, + "The lockfile used when Apache needs to lock the accept() call"}, { "AccessConfig", set_server_string_slot, (void *)XtOffsetOf (server_rec, access_confname), RSRC_CONF, TAKE1, "The filename of the access config file" }, 1.164 +15 -25apache/src/http_main.c Index: http_main.c === RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.163 retrieving revision 1.164 diff -C3 -r1.163 -r1.164 *** http_main.c 1997/06/28 22:39:21 1.163 --- http_main.c 1997/06/28 23:05:14 1.164 *** *** 154,159 --- 154,160 int excess_requests_per_child; char *pid_fname; char *scoreboard_fname; + char *lock_fname; char *server_argv0; struct in_addr bind_address; listen_rec *listeners; *** *** 201,206 --- 202,218 #endif #endif /* WIN32 */ + #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) + static void expand_lock_fname(pool *p) + { + char buf[20]; + + ap_snprintf( buf, sizeof(buf)-1, ".%u", getpid() ); + buf[sizeof(buf)-1] = 0; + lock_fname = pstrcat (p, server_root_relative (p, lock_fname), buf, NULL); + } + #endif + #if defined(USE_FCNTL_SERIALIZED_ACCEPT) static struct flock lock_it; static struct flock unlock_it; *** *** 213,220 */ void accept_mutex_init(pool *p) ! { ! char lock_fname[256]; lock_it.l_whence = SEEK_SET; /* from current point */ lock_it.l_start = 0; /* -"- */ --- 225,231 */ void accept_mutex_init(pool *p) ! { lock_it.l_whence = SEEK_SET; /* from current point */ lock_it.l_start = 0; /* -"- */ *** *** 227,245 unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ unlock_it.l_pid= 0;/* pid not actually interesting */ ! #ifdef __MACHTEN__ ! strncpy(lock_fname, "/var/tmp/htlock.XX", sizeof(lock_fname)-1); ! #else ! strncp
cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
marc97/06/28 16:57:59 Modified:htdocs/manual/mod core.html directives.html src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h Log: Add ListenBacklog directive to control the backlog passed to listen(). Also change the default to 511 for platforms that use an 8-bit datatype to store it. A slightly different implementation than suggested by Taso Devetzis <[EMAIL PROTECTED]>, who submitted the PR. PR: 240 Reviewed by: Dean Gaudet, Jim Jagielski Revision ChangesPath 1.59 +14 -0 apache/htdocs/manual/mod/core.html Index: core.html === RCS file: /export/home/cvs/apache/htdocs/manual/mod/core.html,v retrieving revision 1.58 retrieving revision 1.59 diff -C3 -r1.58 -r1.59 *** core.html 1997/06/22 23:58:38 1.58 --- core.html 1997/06/28 23:57:53 1.59 *** *** 43,48 --- 43,49 KeepAliveTimeoutListen + ListenBacklog MaxClients MaxKeepAliveRequests *** *** 657,662 --- 658,676 See Also: Known Bugs + + ListenBacklog + Syntax: ListenBacklog backlog + Default: ListenBacklog 511 + Context: server config + Status: Core + Compatibility: ListenBacklog is only available in Apache + versions after 1.2.0. + + The maximum length of the queue of pending connections. Generally no + tuning is needed or desired, however on some systems it is desirable + to increase this when under a TCP SYN flood attack. See + the backlog parameter to the listen(2) system call. directive 1.21 +1 -0 apache/htdocs/manual/mod/directives.html Index: directives.html === RCS file: /export/home/cvs/apache/htdocs/manual/mod/directives.html,v retrieving revision 1.20 retrieving revision 1.21 diff -C3 -r1.20 -r1.21 *** directives.html 1997/06/04 16:14:14 1.20 --- directives.html 1997/06/28 23:57:54 1.21 *** *** 103,108 --- 103,109 LanguagePriority Listen + ListenBacklog LoadFile LoadModule 1.12 +1 -0 apache/src/http_conf_globals.h Index: http_conf_globals.h === RCS file: /export/home/cvs/apache/src/http_conf_globals.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C3 -r1.11 -r1.12 *** http_conf_globals.h 1997/06/28 23:05:13 1.11 --- http_conf_globals.h 1997/06/28 23:57:55 1.12 *** *** 71,76 --- 71,77 extern int daemons_max_free; extern int daemons_limit; extern int suexec_enabled; + extern int listenbacklog; extern char *pid_fname; extern char *scoreboard_fname; 1.53 +1 -0 apache/src/http_config.c Index: http_config.c === RCS file: /export/home/cvs/apache/src/http_config.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C3 -r1.52 -r1.53 *** http_config.c 1997/06/28 23:05:13 1.52 --- http_config.c 1997/06/28 23:57:55 1.53 *** *** 1044,1049 --- 1044,1050 max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; bind_address.s_addr = htonl(INADDR_ANY); listeners = NULL; + listenbacklog = DEFAULT_LISTENBACKLOG; } server_rec *init_server_config(pool *p) 1.87 +12 -0 apache/src/http_core.c Index: http_core.c === RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.86 retrieving revision 1.87 diff -C3 -r1.86 -r1.87 *** http_core.c 1997/06/28 23:05:13 1.86 --- http_core.c 1997/06/28 23:57:55 1.87 *** *** 1175,1180 --- 1175,1191 return NULL; } + const char *set_listenbacklog (cmd_parms *cmd, void *dummy, char *arg) { + int b; + + if (cmd->server->is_virtual) + return "ListenBacklog not allowed in "; + b = atoi (arg); + if (b < 1) return "ListenBacklog must be > 0"; + listenbacklog = b; + return NULL; + } + /* Note --- ErrorDocument will now work from .htaccess files. * The AllowOverride of Fileinfo allows webmasters to turn it off */ *** *** 1292,1297 --- 1303,1309 { "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, NULL }, { "ThreadsPerChild", set_threads, NULL, RSRC_CONF, TAKE1, "Number of threads a child creates" }, { "ExcessRequestsPerChild", set_excess_requests, NULL, RSRC_CONF, TAKE1, "Maximum number of