httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@ibm.net>
Subject 2.0: change unix/locks.c to stop opening tmp file if not needed
Date Wed, 01 Mar 2000 20:21:45 GMT
I've tested this on Linux (needs the file) and FreeBSD (does not
need the file).

--- locks.c.old	Tue Jan 25 18:04:27 2000
+++ locks.c	Wed Mar  1 13:55:57 2000
@@ -71,7 +71,7 @@
  *        determine if it should be used.
  * arg 4) The newly created lock structure.
  * NOTE:  APR_CROSS_PROCESS may lock both processes and threads, but it is
- *        only garaunteed to lock processes.
+ *        only guaranteed to lock processes.
  */
 ap_status_t ap_create_lock(struct lock_t **lock, ap_locktype_e type, 
                            ap_lockscope_e scope, char *fname, 
@@ -84,13 +84,18 @@
 
     new->cntxt = cont;
     new->type = type;
-    if (fname != NULL) {
-        new->fname = ap_pstrdup(cont, fname);
-    }
-    else {
-        new->fname = ap_pstrdup(cont, tempnam(NULL, NULL));
-        unlink(new->fname);
+#if defined(USE_FCNTL_SERIALIZE) || defined(USE_FLOCK_SERIALIZE)
+    /* file-based serialization primitives */
+    if (type != APR_INTRAPROCESS) {
+        if (fname != NULL) {
+            new->fname = ap_pstrdup(cont, fname);
+        }
+        else {
+            new->fname = ap_pstrdup(cont, tempnam(NULL, NULL));
+            unlink(new->fname);
+	}
     }
+#endif
 
     if (type != APR_CROSS_PROCESS) {
 #if APR_HAS_THREADS


-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message