trawick 2003/06/07 12:45:10
Modified: . CHANGES
include apr_proc_mutex.h
locks/beos proc_mutex.c
locks/netware proc_mutex.c
locks/os2 proc_mutex.c
locks/unix proc_mutex.c
locks/win32 proc_mutex.c
Log:
Add proc_mutex_lockfile() for retrieving the name of the file
associated with a mutex.
This is used in Apache to simplify the effort of getting permissions
set properly on mutexes that will be created as root but used
as non-root. For flock-based mutexes, chown() needs to be performed
on the mutex file.
Revision Changes Path
1.418 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.417
retrieving revision 1.418
diff -u -r1.417 -r1.418
--- CHANGES 7 Jun 2003 12:37:48 -0000 1.417
+++ CHANGES 7 Jun 2003 19:45:10 -0000 1.418
@@ -1,5 +1,8 @@
Changes with APR 0.9.4
+ *) Add apr_proc_mutex_lockfile() for retrieving the name of the
+ file associated with a mutex. [Jeff Trawick]
+
*) Don't require the lock file name to be passed into
apr_proc_mutex_child_init() or apr_global_mutex_child_init().
This allows child init to work when the lock file was a temp
1.13 +7 -0 apr/include/apr_proc_mutex.h
Index: apr_proc_mutex.h
===================================================================
RCS file: /home/cvs/apr/include/apr_proc_mutex.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- apr_proc_mutex.h 5 Mar 2003 21:22:26 -0000 1.12
+++ apr_proc_mutex.h 7 Jun 2003 19:45:10 -0000 1.13
@@ -171,6 +171,13 @@
APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex);
/**
+ * Return the name of the lockfile for the mutex, or NULL
+ * if the mutex doesn't use a lock file
+ */
+
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex);
+
+/**
* Display the name of the mutex, as it relates to the actual method used.
* This matches the valid options for Apache's AcceptMutex directive
* @param mutex the name of the mutex
1.11 +5 -0 apr/locks/beos/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/beos/proc_mutex.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- proc_mutex.c 6 Jan 2003 23:44:29 -0000 1.10
+++ proc_mutex.c 7 Jun 2003 19:45:10 -0000 1.11
@@ -157,6 +157,11 @@
return stat;
}
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
+{
+ return NULL;
+}
+
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
{
return "beossem";
1.12 +5 -0 apr/locks/netware/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/netware/proc_mutex.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- proc_mutex.c 6 Jan 2003 23:44:30 -0000 1.11
+++ proc_mutex.c 7 Jun 2003 19:45:10 -0000 1.12
@@ -120,6 +120,11 @@
return APR_ENOLOCK;
}
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
+{
+ return NULL;
+}
+
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
{
return "netwarethread";
1.14 +5 -0 apr/locks/os2/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/os2/proc_mutex.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- proc_mutex.c 7 Jan 2003 00:52:54 -0000 1.13
+++ proc_mutex.c 7 Jun 2003 19:45:10 -0000 1.14
@@ -93,6 +93,11 @@
return apr_proc_mutex_destroy(mutex);
}
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
+{
+ return NULL;
+}
+
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
{
return "os2sem";
1.33 +12 -0 apr/locks/unix/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- proc_mutex.c 7 Jun 2003 12:37:48 -0000 1.32
+++ proc_mutex.c 7 Jun 2003 19:45:10 -0000 1.33
@@ -877,6 +877,18 @@
return mutex->meth->name;
}
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
+{
+ /* posix sems use the fname field but don't use a file,
+ * so be careful
+ */
+ if (!strcmp(mutex->meth->name, "flock") ||
+ !strcmp(mutex->meth->name, "fcntl")) {
+ return mutex->fname;
+ }
+ return NULL;
+}
+
APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
/* Implement OS-specific accessors defined in apr_portable.h */
1.14 +5 -0 apr/locks/win32/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/win32/proc_mutex.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- proc_mutex.c 27 Mar 2003 19:51:12 -0000 1.13
+++ proc_mutex.c 7 Jun 2003 19:45:10 -0000 1.14
@@ -205,6 +205,11 @@
return stat;
}
+APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex)
+{
+ return NULL;
+}
+
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
{
return mutex->fname;