dgaudet 97/06/29 11:08:42
Modified: src Tag: APACHE_1_2_X CHANGES conf.h http_conf_globals.h http_config.c http_core.c http_main.c httpd.h Log: LockFile directive and USE_FLOCK changes. Revision Changes Path No revision No revision 1.286.2.18 +7 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.286.2.17 retrieving revision 1.286.2.18 diff -C3 -r1.286.2.17 -r1.286.2.18 *** CHANGES 1997/06/28 22:06:22 1.286.2.17 --- CHANGES 1997/06/29 18:08:34 1.286.2.18 *************** *** 25,30 **** --- 25,34 ---- to the rule that symlink permissions are tested with the symlink options of the parent directory. [Dean Gaudet] PR#353 + *) CONFIG: The LockFile directive can be used to place the serializing + lockfile in any location. It previously defaulted to /usr/tmp/htlock. + [Somehow it took three of us: Jim Jaglieski, Dean Gaudet, Marc Slemko] + *) QUERY_STRING was unescaped in mod_include, it shouldn't be. [Dean Gaudet] PR#644 *************** *** 47,52 **** --- 51,59 ---- problems is under Solaris with many virtualhosts and many Listen directives. But using -DHIGH_SLACK_LINE=256 described above will work around this problem. [Dean Gaudet] + + *) USE_FLOCK_SERIALIZED_ACCEPT is now default for FreeBSD, A/UX, and + SunOS 4. *) Improved unix error response logging. [Marc Slemko] 1.99.2.3 +5 -3 apache/src/conf.h Index: conf.h =================================================================== RCS file: /export/home/cvs/apache/src/conf.h,v retrieving revision 1.99.2.2 retrieving revision 1.99.2.3 diff -C3 -r1.99.2.2 -r1.99.2.3 *** conf.h 1997/06/28 22:20:06 1.99.2.2 --- conf.h 1997/06/29 18:08:35 1.99.2.3 *************** *** 89,94 **** --- 89,95 ---- typedef int rlim_t; #define memmove(a,b,c) bcopy(b,a,c) #define NO_LINGCLOSE + #define USE_FLOCK_SERIALIZED_ACCEPT #elif defined(SOLARIS2) #undef HAVE_GMTOFF *************** *** 317,332 **** #define NEED_STRDUP #define JMP_BUF sigjmp_buf /* fcntl() locking is expensive with NFS */ ! #undef USE_FLOCK_SERIALIZED_ACCEPT #define HAVE_SHMGET - #define MOVEBREAK 0x4000000 /* * NOTE: If when you run Apache under A/UX and you get a warning ! * that httpd couldn't move break, then the above value for * MOVEBREAK (64megs) is too large for your setup. Try reducing * to 0x2000000 which is still PLENTY of space. I doubt if * even on heavy systems sbrk() would be called at all... */ #define NO_LINGCLOSE #define NO_SLACK --- 318,333 ---- #define NEED_STRDUP #define JMP_BUF sigjmp_buf /* fcntl() locking is expensive with NFS */ ! #define USE_FLOCK_SERIALIZED_ACCEPT #define HAVE_SHMGET /* * NOTE: If when you run Apache under A/UX and you get a warning ! * that httpd couldn't move break, then the below value for * MOVEBREAK (64megs) is too large for your setup. Try reducing * to 0x2000000 which is still PLENTY of space. I doubt if * even on heavy systems sbrk() would be called at all... */ + #define MOVEBREAK 0x4000000 #define NO_LINGCLOSE #define NO_SLACK *************** *** 411,416 **** --- 412,418 ---- (defined(__FreeBSD_version) && (__FreeBSD_version < 220000)) typedef quad_t rlim_t; #endif + #define USE_FLOCK_SERIALIZED_ACCEPT #elif defined(QNX) #ifndef crypt 1.9.2.1 +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.9 retrieving revision 1.9.2.1 diff -C3 -r1.9 -r1.9.2.1 *** http_conf_globals.h 1997/01/01 18:10:16 1.9 --- http_conf_globals.h 1997/06/29 18:08:35 1.9.2.1 *************** *** 72,77 **** --- 72,78 ---- 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.49.2.2 +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.49.2.1 retrieving revision 1.49.2.2 diff -C3 -r1.49.2.1 -r1.49.2.2 *** http_config.c 1997/06/27 01:47:45 1.49.2.1 --- http_config.c 1997/06/29 18:08:36 1.49.2.2 *************** *** 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.81.2.2 +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.81.2.1 retrieving revision 1.81.2.2 diff -C3 -r1.81.2.1 -r1.81.2.2 *** http_core.c 1997/06/28 22:00:16 1.81.2.1 --- http_core.c 1997/06/29 18:08:36 1.81.2.2 *************** *** 967,972 **** --- 967,977 ---- 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; *************** *** 1216,1221 **** --- 1221,1228 ---- "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.149.2.4 +14 -25 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.149.2.3 retrieving revision 1.149.2.4 diff -C3 -r1.149.2.3 -r1.149.2.4 *** http_main.c 1997/06/27 02:31:14 1.149.2.3 --- http_main.c 1997/06/29 18:08:37 1.149.2.4 *************** *** 138,143 **** --- 138,144 ---- int max_requests_per_child; char *pid_fname; char *scoreboard_fname; + char *lock_fname; char *server_argv0; struct in_addr bind_address; listen_rec *listeners; *************** *** 181,186 **** --- 182,197 ---- #define ap_killpg(x, y) (killpg ((x), (y))) #endif + #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), ".%u", getpid() ); + 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; *************** *** 193,200 **** */ void accept_mutex_init(pool *p) ! { ! char lock_fname[256]; lock_it.l_whence = SEEK_SET; /* from current point */ lock_it.l_start = 0; /* -"- */ --- 204,210 ---- */ void accept_mutex_init(pool *p) ! { lock_it.l_whence = SEEK_SET; /* from current point */ lock_it.l_start = 0; /* -"- */ *************** *** 207,225 **** 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.XXXXXX", sizeof(lock_fname)-1); ! #else ! strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); ! #endif ! lock_fname[sizeof(lock_fname)-1] = '\0'; ! ! if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0') ! { ! fprintf (stderr, "Cannot assign name to lock file!\n"); ! exit (1); ! } ! lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); if (lock_fd == -1) { --- 217,223 ---- unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ unlock_it.l_pid = 0; /* pid not actually interesting */ ! expand_lock_fname (p); lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); if (lock_fd == -1) { *************** *** 264,280 **** void accept_mutex_init(pool *p) { - char lock_fname[256]; - - strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); - lock_fname[sizeof(lock_fname)-1] = '\0'; - - if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0') - { - fprintf (stderr, "Cannot assign name to lock file!\n"); - exit (1); - } lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); if (lock_fd == -1) { --- 262,269 ---- void accept_mutex_init(pool *p) { + expand_lock_fname (p); lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); if (lock_fd == -1) { 1.111.2.2 +1 -0 apache/src/httpd.h Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.111.2.1 retrieving revision 1.111.2.2 diff -C3 -r1.111.2.1 -r1.111.2.2 *** httpd.h 1997/06/27 01:47:47 1.111.2.1 --- httpd.h 1997/06/29 18:08:38 1.111.2.2 *************** *** 126,131 **** --- 126,132 ---- #endif #define DEFAULT_PIDLOG "logs/httpd.pid" #define DEFAULT_SCOREBOARD "logs/apache_runtime_status" + #define DEFAULT_LOCKFILE "logs/accept.lock" /* Define this to be what your HTML directory content files are called */ #define DEFAULT_INDEX "index.html"