]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
LockFile directive and USE_FLOCK changes.
authordgaudet <dgaudet@unknown>
Sun, 29 Jun 1997 18:08:38 +0000 (18:08 +0000)
committerdgaudet <dgaudet@unknown>
Sun, 29 Jun 1997 18:08:38 +0000 (18:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3@78446 13f79535-47bb-0310-9956-ffa450edef68

APACHE_1_2_X/src/CHANGES
APACHE_1_2_X/src/include/ap_config.h
APACHE_1_2_X/src/include/conf.h
APACHE_1_2_X/src/include/http_conf_globals.h
APACHE_1_2_X/src/include/httpd.h
APACHE_1_2_X/src/main/http_config.c
APACHE_1_2_X/src/main/http_core.c
APACHE_1_2_X/src/main/http_main.c

index a70e56cf6bc5e6fd7b95b66c82cf5e1bb51f1c71..5d3989ea1697de263c4b6a543e6e1853e4de2dfd 100644 (file)
@@ -25,6 +25,10 @@ Changes with Apache 1.2.1
      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
 
@@ -48,6 +52,9 @@ Changes with Apache 1.2.1
      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]
 
   *) Update mod_rewrite from 3.0.5 to 3.0.6.  New ruleflag
index 423abd9fcd4bf011a10660618e1f416041512aec..1ddc9fdc77b04c78f6d6636292ec2268ccadb442 100644 (file)
@@ -89,6 +89,7 @@ char *mktemp(char *template);
 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,16 +318,16 @@ extern char *crypt();
 #define NEED_STRDUP
 #define JMP_BUF sigjmp_buf
 /* fcntl() locking is expensive with NFS */
-#undef USE_FLOCK_SERIALIZED_ACCEPT
+#define 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
+ * 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,6 +412,7 @@ extern char *crypt();
 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
 typedef quad_t rlim_t;
 #endif
+#define USE_FLOCK_SERIALIZED_ACCEPT
 
 #elif defined(QNX)
 #ifndef crypt
index 423abd9fcd4bf011a10660618e1f416041512aec..1ddc9fdc77b04c78f6d6636292ec2268ccadb442 100644 (file)
@@ -89,6 +89,7 @@ char *mktemp(char *template);
 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,16 +318,16 @@ extern char *crypt();
 #define NEED_STRDUP
 #define JMP_BUF sigjmp_buf
 /* fcntl() locking is expensive with NFS */
-#undef USE_FLOCK_SERIALIZED_ACCEPT
+#define 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
+ * 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,6 +412,7 @@ extern char *crypt();
 (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
 typedef quad_t rlim_t;
 #endif
+#define USE_FLOCK_SERIALIZED_ACCEPT
 
 #elif defined(QNX)
 #ifndef crypt
index 0596ab4460bef8d868a6dd6aa8e62acebec1e5cc..3a60e7db77b5414b4c571a2a89923931a5b5f13a 100644 (file)
@@ -72,6 +72,7 @@ extern int suexec_enabled;
 
 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*
index 00e7347f2a4ca84da3e09adf28704261dc861ce3..a8c82c5cd8e960e5c0694f05837e0682e511c350 100644 (file)
 #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"
index 9b37b2bdb869c73e99b1dc08eb63e35101a00fa6..16f2fec02a7ba8ce4fddda5f50926e5c95db3b57 100644 (file)
@@ -1040,6 +1040,7 @@ void init_config_globals (pool *p)
     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;
index f3cf492627a2294dd8d30e0daed59eb76fb5ac05..39a6e6bc8f6097318bc1bf1bc6c3ba282d8127e9 100644 (file)
@@ -967,6 +967,11 @@ const char *set_scoreboard (cmd_parms *cmd, void *dummy, char *arg) {
     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,6 +1221,8 @@ command_rec core_cmds[] = {
     "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" },
index 443ebc236476257669ef74df10cbf2250e57bc26..aa5c41b9b4c62addda3fdd5179251ec237830a84 100644 (file)
@@ -138,6 +138,7 @@ gid_t group_id_list[NGROUPS_MAX];
 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,6 +182,16 @@ int one_process = 0;
 #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,8 +204,7 @@ static int lock_fd=-1;
  */
 void
 accept_mutex_init(pool *p)
-    {
-    char lock_fname[256];
+{
 
     lock_it.l_whence = SEEK_SET;   /* from current point */
     lock_it.l_start  = 0;          /* -"- */
@@ -207,19 +217,7 @@ accept_mutex_init(pool *p)
     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);
-    }
-
+    expand_lock_fname (p);
     lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
     if (lock_fd == -1)
     {
@@ -264,17 +262,8 @@ static int lock_fd=-1;
 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);
-    }
 
+    expand_lock_fname (p);
     lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644);
     if (lock_fd == -1)
     {