Index: locks/os2/proc_mutex.c
===================================================================
--- locks/os2/proc_mutex.c	(revision 1587334)
+++ locks/os2/proc_mutex.c	(working copy)
@@ -211,7 +211,7 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(ap
                                                 apr_proc_mutex_t *pmutex)
 {
     *ospmutex = pmutex->hMutex;
-    return APR_ENOTIMPL;
+    return APR_SUCCESS;
 }
 
 
@@ -221,6 +221,9 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(ap
                                                 apr_pool_t *pool)
 {
     apr_proc_mutex_t *new;
+    if (pool == NULL) {
+        return APR_ENOPOOL;
+    }
 
     new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));
     new->pool       = pool;
Index: locks/unix/proc_mutex.c
===================================================================
--- locks/unix/proc_mutex.c	(revision 1587334)
+++ locks/unix/proc_mutex.c	(working copy)
@@ -45,6 +45,19 @@ static apr_status_t proc_mutex_no_perms_set(apr_pr
 }
 #endif    
 
+static void proc_mutex_init(apr_proc_mutex_t *mutex, apr_os_proc_mutex_t *os)
+{
+    if (os) {
+        mutex->os = *os;
+    }
+    else {
+        apr_os_proc_mutex_reset(&mutex->os);
+    }
+#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
+    mutex->interproc = NULL;
+    mutex->interproc_only = 0;
+#endif
+}
 
 #if APR_HAS_POSIXSEM_SERIALIZE
 
@@ -56,7 +69,7 @@ static apr_status_t proc_mutex_posix_cleanup(void
 {
     apr_proc_mutex_t *mutex = mutex_;
     
-    if (sem_close(mutex->psem_interproc) < 0) {
+    if (sem_close(mutex->os.psem_interproc) < 0) {
         return errno;
     }
 
@@ -71,8 +84,8 @@ static apr_status_t proc_mutex_posix_create(apr_pr
     sem_t *psem;
     char semname[APR_MD5_DIGESTSIZE * 2 + 2];
     
-    new_mutex->interproc = apr_palloc(new_mutex->pool,
-                                      sizeof(*new_mutex->interproc));
+    proc_mutex_init(new_mutex, NULL);
+
     /*
      * This bogusness is to follow what appears to be the
      * lowest common denominator in Posix semaphore naming:
@@ -131,7 +144,7 @@ static apr_status_t proc_mutex_posix_create(apr_pr
     }
     /* Ahhh. The joys of Posix sems. Predelete it... */
     sem_unlink(semname);
-    new_mutex->psem_interproc = psem;
+    new_mutex->os.psem_interproc = psem;
     new_mutex->fname = apr_pstrdup(new_mutex->pool, semname);
     apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex,
                               apr_proc_mutex_cleanup, 
@@ -141,7 +154,7 @@ static apr_status_t proc_mutex_posix_create(apr_pr
 
 static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex)
 {
-    if (sem_wait(mutex->psem_interproc) < 0) {
+    if (sem_wait(mutex->os.psem_interproc) < 0) {
         return errno;
     }
     mutex->curr_locked = 1;
@@ -150,7 +163,7 @@ static apr_status_t proc_mutex_posix_acquire(apr_p
 
 static apr_status_t proc_mutex_posix_tryacquire(apr_proc_mutex_t *mutex)
 {
-    if (sem_trywait(mutex->psem_interproc) < 0) {
+    if (sem_trywait(mutex->os.psem_interproc) < 0) {
         if (errno == EAGAIN) {
             return APR_EBUSY;
         }
@@ -163,7 +176,7 @@ static apr_status_t proc_mutex_posix_tryacquire(ap
 static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex)
 {
     mutex->curr_locked = 0;
-    if (sem_post(mutex->psem_interproc) < 0) {
+    if (sem_post(mutex->os.psem_interproc) < 0) {
         /* any failure is probably fatal, so no big deal to leave
          * ->curr_locked at 0. */
         return errno;
@@ -214,9 +227,9 @@ static apr_status_t proc_mutex_sysv_cleanup(void *
     apr_proc_mutex_t *mutex=mutex_;
     union semun ick;
     
-    if (mutex->interproc->filedes != -1) {
+    if (mutex->os.crossproc != -1) {
         ick.val = 0;
-        semctl(mutex->interproc->filedes, 0, IPC_RMID, ick);
+        semctl(mutex->os.crossproc, 0, IPC_RMID, ick);
     }
     return APR_SUCCESS;
 }    
@@ -227,18 +240,19 @@ static apr_status_t proc_mutex_sysv_create(apr_pro
     union semun ick;
     apr_status_t rv;
     
-    new_mutex->interproc = apr_palloc(new_mutex->pool, sizeof(*new_mutex->interproc));
-    new_mutex->interproc->filedes = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);
+    proc_mutex_init(new_mutex, NULL);
 
-    if (new_mutex->interproc->filedes < 0) {
+    new_mutex->os.crossproc = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);
+    if (new_mutex->os.crossproc == -1) {
         rv = errno;
         proc_mutex_sysv_cleanup(new_mutex);
         return rv;
     }
     ick.val = 1;
-    if (semctl(new_mutex->interproc->filedes, 0, SETVAL, ick) < 0) {
+    if (semctl(new_mutex->os.crossproc, 0, SETVAL, ick) < 0) {
         rv = errno;
         proc_mutex_sysv_cleanup(new_mutex);
+        new_mutex->os.crossproc = -1;
         return rv;
     }
     new_mutex->curr_locked = 0;
@@ -253,7 +267,7 @@ static apr_status_t proc_mutex_sysv_acquire(apr_pr
     int rc;
 
     do {
-        rc = semop(mutex->interproc->filedes, &proc_mutex_op_on, 1);
+        rc = semop(mutex->os.crossproc, &proc_mutex_op_on, 1);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -267,7 +281,7 @@ static apr_status_t proc_mutex_sysv_tryacquire(apr
     int rc;
 
     do {
-        rc = semop(mutex->interproc->filedes, &proc_mutex_op_try, 1);
+        rc = semop(mutex->os.crossproc, &proc_mutex_op_try, 1);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         if (errno == EAGAIN) {
@@ -285,7 +299,7 @@ static apr_status_t proc_mutex_sysv_release(apr_pr
 
     mutex->curr_locked = 0;
     do {
-        rc = semop(mutex->interproc->filedes, &proc_mutex_op_off, 1);
+        rc = semop(mutex->os.crossproc, &proc_mutex_op_off, 1);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -305,7 +319,7 @@ static apr_status_t proc_mutex_sysv_perms_set(apr_
     buf.sem_perm.gid = gid;
     buf.sem_perm.mode = apr_unix_perms2mode(perms);
     ick.buf = &buf;
-    if (semctl(mutex->interproc->filedes, 0, IPC_SET, ick) < 0) {
+    if (semctl(mutex->os.crossproc, 0, IPC_SET, ick) < 0) {
         return errno;
     }
     return APR_SUCCESS;
@@ -338,7 +352,7 @@ static apr_status_t proc_mutex_proc_pthread_cleanu
     apr_status_t rv;
 
     if (mutex->curr_locked == 1) {
-        if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) {
+        if ((rv = pthread_mutex_unlock(mutex->os.pthread_interproc))) {
 #ifdef HAVE_ZOS_PTHREADS
             rv = errno;
 #endif
@@ -347,14 +361,14 @@ static apr_status_t proc_mutex_proc_pthread_cleanu
     }
     /* curr_locked is set to -1 until the mutex has been created */
     if (mutex->curr_locked != -1) {
-        if ((rv = pthread_mutex_destroy(mutex->pthread_interproc))) {
+        if ((rv = pthread_mutex_destroy(mutex->os.pthread_interproc))) {
 #ifdef HAVE_ZOS_PTHREADS
             rv = errno;
 #endif
             return rv;
         }
     }
-    if (munmap((caddr_t)mutex->pthread_interproc, sizeof(pthread_mutex_t))) {
+    if (munmap((caddr_t)mutex->os.pthread_interproc, sizeof(pthread_mutex_t))) {
         return errno;
     }
     return APR_SUCCESS;
@@ -367,17 +381,19 @@ static apr_status_t proc_mutex_proc_pthread_create
     int fd;
     pthread_mutexattr_t mattr;
 
+    proc_mutex_init(new_mutex, NULL);
+
     fd = open("/dev/zero", O_RDWR);
     if (fd < 0) {
         return errno;
     }
 
-    new_mutex->pthread_interproc = (pthread_mutex_t *)mmap(
-                                       (caddr_t) 0, 
-                                       sizeof(pthread_mutex_t), 
-                                       PROT_READ | PROT_WRITE, MAP_SHARED,
-                                       fd, 0); 
-    if (new_mutex->pthread_interproc == (pthread_mutex_t *) (caddr_t) -1) {
+    new_mutex->os.pthread_interproc = (pthread_mutex_t *)mmap(
+                                           (caddr_t) 0, 
+                                           sizeof(pthread_mutex_t), 
+                                           PROT_READ | PROT_WRITE, MAP_SHARED,
+                                           fd, 0); 
+    if (new_mutex->os.pthread_interproc == (pthread_mutex_t *) (caddr_t) -1) {
         close(fd);
         return errno;
     }
@@ -421,7 +437,7 @@ static apr_status_t proc_mutex_proc_pthread_create
     }
 #endif /* HAVE_PTHREAD_MUTEX_ROBUST */
 
-    if ((rv = pthread_mutex_init(new_mutex->pthread_interproc, &mattr))) {
+    if ((rv = pthread_mutex_init(new_mutex->os.pthread_interproc, &mattr))) {
 #ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
@@ -451,14 +467,14 @@ static apr_status_t proc_mutex_proc_pthread_acquir
 {
     apr_status_t rv;
 
-    if ((rv = pthread_mutex_lock(mutex->pthread_interproc))) {
+    if ((rv = pthread_mutex_lock(mutex->os.pthread_interproc))) {
 #ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
 #ifdef HAVE_PTHREAD_MUTEX_ROBUST
         /* Okay, our owner died.  Let's try to make it consistent again. */
         if (rv == EOWNERDEAD) {
-            pthread_mutex_consistent_np(mutex->pthread_interproc);
+            pthread_mutex_consistent_np(mutex->os.pthread_interproc);
         }
         else
             return rv;
@@ -474,7 +490,7 @@ static apr_status_t proc_mutex_proc_pthread_tryacq
 {
     apr_status_t rv;
  
-    if ((rv = pthread_mutex_trylock(mutex->pthread_interproc))) {
+    if ((rv = pthread_mutex_trylock(mutex->os.pthread_interproc))) {
 #ifdef HAVE_ZOS_PTHREADS 
         rv = errno;
 #endif
@@ -484,7 +500,7 @@ static apr_status_t proc_mutex_proc_pthread_tryacq
 #ifdef HAVE_PTHREAD_MUTEX_ROBUST
         /* Okay, our owner died.  Let's try to make it consistent again. */
         if (rv == EOWNERDEAD) {
-            pthread_mutex_consistent_np(mutex->pthread_interproc);
+            pthread_mutex_consistent_np(mutex->os.pthread_interproc);
             rv = APR_SUCCESS;
         }
         else
@@ -502,7 +518,7 @@ static apr_status_t proc_mutex_proc_pthread_releas
     apr_status_t rv;
 
     mutex->curr_locked = 0;
-    if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) {
+    if ((rv = pthread_mutex_unlock(mutex->os.pthread_interproc))) {
 #ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
@@ -549,7 +565,7 @@ static void proc_mutex_fcntl_setup(void)
 
 static apr_status_t proc_mutex_fcntl_cleanup(void *mutex_)
 {
-    apr_status_t status;
+    apr_status_t status = APR_SUCCESS;
     apr_proc_mutex_t *mutex=mutex_;
 
     if (mutex->curr_locked == 1) {
@@ -558,7 +574,16 @@ static apr_status_t proc_mutex_fcntl_cleanup(void
             return status;
     }
         
-    return apr_file_close(mutex->interproc);
+    if (mutex->interproc) {
+        status = apr_file_close(mutex->interproc);
+    }
+    if (!mutex->interproc_only
+            && mutex->os.crossproc != -1
+            && close(mutex->os.crossproc) == -1
+            && status == APR_SUCCESS) {
+        status = errno;
+    }
+    return status;
 }    
 
 static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex,
@@ -566,6 +591,8 @@ static apr_status_t proc_mutex_fcntl_create(apr_pr
 {
     int rv;
  
+    proc_mutex_init(new_mutex, NULL);
+
     if (fname) {
         new_mutex->fname = apr_pstrdup(new_mutex->pool, fname);
         rv = apr_file_open(&new_mutex->interproc, new_mutex->fname,
@@ -584,6 +611,8 @@ static apr_status_t proc_mutex_fcntl_create(apr_pr
         return rv;
     }
 
+    new_mutex->os.crossproc = new_mutex->interproc->filedes;
+    new_mutex->interproc_only = 1;
     new_mutex->curr_locked = 0;
     unlink(new_mutex->fname);
     apr_pool_cleanup_register(new_mutex->pool,
@@ -598,7 +627,7 @@ static apr_status_t proc_mutex_fcntl_acquire(apr_p
     int rc;
 
     do {
-        rc = fcntl(mutex->interproc->filedes, F_SETLKW, &proc_mutex_lock_it);
+        rc = fcntl(mutex->os.crossproc, F_SETLKW, &proc_mutex_lock_it);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -612,7 +641,7 @@ static apr_status_t proc_mutex_fcntl_tryacquire(ap
     int rc;
 
     do {
-        rc = fcntl(mutex->interproc->filedes, F_SETLK, &proc_mutex_lock_it);
+        rc = fcntl(mutex->os.crossproc, F_SETLK, &proc_mutex_lock_it);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
 #if FCNTL_TRYACQUIRE_EACCES
@@ -634,7 +663,7 @@ static apr_status_t proc_mutex_fcntl_release(apr_p
 
     mutex->curr_locked=0;
     do {
-        rc = fcntl(mutex->interproc->filedes, F_SETLKW, &proc_mutex_unlock_it);
+        rc = fcntl(mutex->os.crossproc, F_SETLKW, &proc_mutex_unlock_it);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -651,7 +680,7 @@ static apr_status_t proc_mutex_fcntl_perms_set(apr
     if (mutex->fname) {
         if (!(perms & APR_FPROT_GSETID))
             gid = -1;
-        if (fchown(mutex->interproc->filedes, uid, gid) < 0) {
+        if (fchown(mutex->os.crossproc, uid, gid) < 0) {
             return errno;
         }
     }
@@ -683,7 +712,7 @@ static apr_status_t proc_mutex_flock_release(apr_p
 
 static apr_status_t proc_mutex_flock_cleanup(void *mutex_)
 {
-    apr_status_t status;
+    apr_status_t status = APR_SUCCESS;
     apr_proc_mutex_t *mutex=mutex_;
 
     if (mutex->curr_locked == 1) {
@@ -692,10 +721,18 @@ static apr_status_t proc_mutex_flock_cleanup(void
             return status;
     }
     if (mutex->interproc) { /* if it was opened properly */
-        apr_file_close(mutex->interproc);
+        status = apr_file_close(mutex->interproc);
     }
-    unlink(mutex->fname);
-    return APR_SUCCESS;
+    if (!mutex->interproc_only
+            && mutex->os.crossproc != -1
+            && close(mutex->os.crossproc) == -1
+            && status == APR_SUCCESS) {
+        status = errno;
+    }
+    if (mutex->fname) {
+        unlink(mutex->fname);
+    }
+    return status;
 }    
 
 static apr_status_t proc_mutex_flock_create(apr_proc_mutex_t *new_mutex,
@@ -703,6 +740,8 @@ static apr_status_t proc_mutex_flock_create(apr_pr
 {
     int rv;
  
+    proc_mutex_init(new_mutex, NULL);
+
     if (fname) {
         new_mutex->fname = apr_pstrdup(new_mutex->pool, fname);
         rv = apr_file_open(&new_mutex->interproc, new_mutex->fname,
@@ -719,8 +758,11 @@ static apr_status_t proc_mutex_flock_create(apr_pr
  
     if (rv != APR_SUCCESS) {
         proc_mutex_flock_cleanup(new_mutex);
-        return errno;
+        return rv;
     }
+
+    new_mutex->os.crossproc = new_mutex->interproc->filedes;
+    new_mutex->interproc_only = 1;
     new_mutex->curr_locked = 0;
     apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex,
                               apr_proc_mutex_cleanup,
@@ -733,7 +775,7 @@ static apr_status_t proc_mutex_flock_acquire(apr_p
     int rc;
 
     do {
-        rc = flock(mutex->interproc->filedes, LOCK_EX);
+        rc = flock(mutex->os.crossproc, LOCK_EX);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -747,7 +789,7 @@ static apr_status_t proc_mutex_flock_tryacquire(ap
     int rc;
 
     do {
-        rc = flock(mutex->interproc->filedes, LOCK_EX | LOCK_NB);
+        rc = flock(mutex->os.crossproc, LOCK_EX | LOCK_NB);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         if (errno == EWOULDBLOCK || errno == EAGAIN) {
@@ -765,7 +807,7 @@ static apr_status_t proc_mutex_flock_release(apr_p
 
     mutex->curr_locked = 0;
     do {
-        rc = flock(mutex->interproc->filedes, LOCK_UN);
+        rc = flock(mutex->os.crossproc, LOCK_UN);
     } while (rc < 0 && errno == EINTR);
     if (rc < 0) {
         return errno;
@@ -780,18 +822,22 @@ static apr_status_t proc_mutex_flock_child_init(ap
     apr_proc_mutex_t *new_mutex;
     int rv;
 
-    new_mutex = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));
-
-    memcpy(new_mutex, *mutex, sizeof *new_mutex);
+    new_mutex = (apr_proc_mutex_t *)apr_pmemdup(pool, *mutex,
+                                                sizeof(apr_proc_mutex_t));
     new_mutex->pool = pool;
-    if (!fname) {
+    proc_mutex_init(new_mutex, NULL);
+    if (fname == NULL) {
         fname = (*mutex)->fname;
     }
-    new_mutex->fname = apr_pstrdup(pool, fname);
-    rv = apr_file_open(&new_mutex->interproc, new_mutex->fname,
-                       APR_FOPEN_WRITE, 0, new_mutex->pool);
-    if (rv != APR_SUCCESS) {
-        return rv;
+    if (fname != NULL) {
+        new_mutex->fname = apr_pstrdup(pool, fname);
+        rv = apr_file_open(&new_mutex->interproc, new_mutex->fname,
+                           APR_FOPEN_WRITE, 0, new_mutex->pool);
+        if (rv != APR_SUCCESS) {
+            return rv;
+        }
+        new_mutex->os.crossproc = new_mutex->interproc->filedes;
+        new_mutex->interproc_only = 1;
     }
     *mutex = new_mutex;
     return APR_SUCCESS;
@@ -806,7 +852,7 @@ static apr_status_t proc_mutex_flock_perms_set(apr
     if (mutex->fname) {
         if (!(perms & APR_FPROT_GSETID))
             gid = -1;
-        if (fchown(mutex->interproc->filedes, uid, gid) < 0) {
+        if (fchown(mutex->os.crossproc, uid, gid) < 0) {
             return errno;
         }
     }
@@ -1012,17 +1058,7 @@ APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
 APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
                                                 apr_proc_mutex_t *pmutex)
 {
-#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE
-    if (pmutex->interproc) {
-        ospmutex->crossproc = pmutex->interproc->filedes;
-    }
-    else {
-        ospmutex->crossproc = -1;
-    }
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    ospmutex->pthread_interproc = pmutex->pthread_interproc;
-#endif
+    *ospmutex = pmutex->os;
     return APR_SUCCESS;
 }
 
@@ -1030,20 +1066,29 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(ap
                                                 apr_os_proc_mutex_t *ospmutex,
                                                 apr_pool_t *pool)
 {
+    apr_status_t rv;
     if (pool == NULL) {
         return APR_ENOPOOL;
     }
+    rv = APR_SUCCESS;
     if ((*pmutex) == NULL) {
         (*pmutex) = (apr_proc_mutex_t *)apr_pcalloc(pool,
                                                     sizeof(apr_proc_mutex_t));
         (*pmutex)->pool = pool;
     }
-#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE
-    apr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, 0, pool);
+    proc_mutex_init(*pmutex, ospmutex);
+#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
+    if (ospmutex->crossproc != -1) {
+        rv = apr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, 0,
+                             pool);
+        if (rv == APR_SUCCESS) {
+            (*pmutex)->os.crossproc = (*pmutex)->interproc->filedes;
+        }
+        else {
+            (*pmutex)->os.crossproc = -1;
+        }
+    }
 #endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    (*pmutex)->pthread_interproc = ospmutex->pthread_interproc;
-#endif
-    return APR_SUCCESS;
+    return rv;
 }
 
Index: locks/netware/proc_mutex.c
===================================================================
--- locks/netware/proc_mutex.c	(revision 1587334)
+++ locks/netware/proc_mutex.c	(working copy)
@@ -106,15 +106,27 @@ APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
 apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
                                    apr_proc_mutex_t *pmutex)
 {
-    if (pmutex)
-        ospmutex = pmutex->mutex->mutex;
-    return APR_ENOLOCK;
+    if (!pmutex->mutex) {
+        ospmutex = NULL;
+        return APR_ENOLOCK;
+    }
+    ospmutex = pmutex->mutex->mutex;
+    return APR_SUCCESS;
 }
 
 apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
                                    apr_os_proc_mutex_t *ospmutex,
                                    apr_pool_t *pool)
 {
-    return APR_ENOTIMPL;
+    if (pool == NULL) {
+        return APR_ENOPOOL;
+    }
+    (*pmutex) = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof **pmutex);
+    (*pmutex)->mutex = (apr_proc_mutex_t *)apr_pcalloc(pool,
+                                             sizeof *(*pmutex)->mutex);
+    (*pmutex)->mutex->mutex = ospmutex;
+    (*pmutex)->mutex->pool = pool;
+    (*pmutex)->pool = pool;
+    return APR_SUCCESS;
 }
 
Index: include/apr_portable.h
===================================================================
--- include/apr_portable.h	(revision 1587334)
+++ include/apr_portable.h	(working copy)
@@ -46,6 +46,9 @@
 #if APR_HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
+#if APR_HAVE_SEMAPHORE_H
+#include <semaphore.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -133,12 +136,14 @@ struct apr_os_proc_mutex_t {
     /** Value used for PTHREAD serialization */
     pthread_mutex_t *pthread_interproc;
 #endif
-#if APR_HAS_THREADS
     /* If no threads, no need for thread locks */
-#if APR_USE_PTHREAD_SERIALIZE
+#if APR_USE_PTHREAD_SERIALIZE && APR_HAS_THREADS
     /** This value is currently unused within APR and Apache */ 
     pthread_mutex_t *intraproc;
 #endif
+#if APR_HAS_POSIXSEM_SERIALIZE
+    /** Value used for POSIX semaphores serialization */
+    sem_t *psem_interproc;
 #endif
 };
 
@@ -148,6 +153,23 @@ typedef int                   apr_os_sock_t;
 typedef struct apr_os_proc_mutex_t  apr_os_proc_mutex_t; /**< native process
                                                           *   mutex
                                                           */
+static APR_INLINE void apr_os_proc_mutex_reset(apr_os_proc_mutex_t *ospmutex)
+{
+#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
+    ospmutex->crossproc = -1;
+#endif
+#if APR_HAS_PROC_PTHREAD_SERIALIZE
+    ospmutex->pthread_interproc = NULL;
+#endif
+    /* If no threads, no need for thread locks */
+#if APR_USE_PTHREAD_SERIALIZE && APR_HAS_THREADS
+    ospmutex->intraproc = NULL;
+#endif
+#if APR_HAS_POSIXSEM_SERIALIZE
+    /** Value used for POSIX semaphores serialization */
+    ospmutex->psem_interproc = NULL;
+#endif
+}
 #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H 
 typedef pthread_t             apr_os_thread_t;      /**< native thread */
 typedef pthread_key_t         apr_os_threadkey_t;   /**< native thread address
Index: include/arch/unix/apr_arch_proc_mutex.h
===================================================================
--- include/arch/unix/apr_arch_proc_mutex.h	(revision 1587334)
+++ include/arch/unix/apr_arch_proc_mutex.h	(working copy)
@@ -62,9 +62,6 @@
 #if APR_HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
-#if APR_HAVE_SEMAPHORE_H
-#include <semaphore.h>
-#endif
 /* End System Headers */
 
 struct apr_proc_mutex_unix_lock_methods_t {
@@ -97,15 +94,11 @@ struct apr_proc_mutex_t {
     const apr_proc_mutex_unix_lock_methods_t *inter_meth;
     int curr_locked;
     char *fname;
-#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
+    apr_os_proc_mutex_t os;
+#if APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
     apr_file_t *interproc;
+    int interproc_only;
 #endif
-#if APR_HAS_POSIXSEM_SERIALIZE
-    sem_t *psem_interproc;
-#endif
-#if APR_HAS_PROC_PTHREAD_SERIALIZE
-    pthread_mutex_t *pthread_interproc;
-#endif
 };
 
 void apr_proc_mutex_unix_setup_lock(void);
