apr/apr-proc-mutex-map-anon.patch

32 lines
1.1 KiB
Diff

Index: apr-1.6.2/locks/unix/proc_mutex.c
===================================================================
--- apr-1.6.2.orig/locks/unix/proc_mutex.c
+++ apr-1.6.2/locks/unix/proc_mutex.c
@@ -435,24 +435,16 @@ static apr_status_t proc_mutex_pthread_c
const char *fname)
{
apr_status_t rv;
- int fd;
pthread_mutexattr_t mattr;
- fd = open("/dev/zero", O_RDWR);
- if (fd < 0) {
- return errno;
- }
-
new_mutex->os.pthread_interproc = mmap(NULL, sizeof(proc_pthread_mutex_t),
- PROT_READ | PROT_WRITE, MAP_SHARED,
- fd, 0);
+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS,
+ -1, 0);
if (new_mutex->os.pthread_interproc == MAP_FAILED) {
new_mutex->os.pthread_interproc = NULL;
rv = errno;
- close(fd);
return rv;
}
- close(fd);
new_mutex->pthread_refcounting = 1;
new_mutex->curr_locked = -1; /* until the mutex has been created */