diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-07 19:45:10 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2003-06-07 19:45:10 +0000 |
commit | e171b9324b8f9ff93bb3ea53543f9face7dc5638 (patch) | |
tree | 8c275a9c3aa7fd5ebb74d59bf026dd93cec91693 /locks | |
parent | 41fe3b39aa4eb8869d3701e9411784d633ea2907 (diff) | |
download | libapr-e171b9324b8f9ff93bb3ea53543f9face7dc5638.tar.gz |
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.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64531 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/beos/proc_mutex.c | 5 | ||||
-rw-r--r-- | locks/netware/proc_mutex.c | 5 | ||||
-rw-r--r-- | locks/os2/proc_mutex.c | 5 | ||||
-rw-r--r-- | locks/unix/proc_mutex.c | 12 | ||||
-rw-r--r-- | locks/win32/proc_mutex.c | 5 |
5 files changed, 32 insertions, 0 deletions
diff --git a/locks/beos/proc_mutex.c b/locks/beos/proc_mutex.c index 405a0b15e..bf4d7c3e5 100644 --- a/locks/beos/proc_mutex.c +++ b/locks/beos/proc_mutex.c @@ -157,6 +157,11 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) 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"; diff --git a/locks/netware/proc_mutex.c b/locks/netware/proc_mutex.c index 075d98305..789f0f81e 100644 --- a/locks/netware/proc_mutex.c +++ b/locks/netware/proc_mutex.c @@ -120,6 +120,11 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) 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"; diff --git a/locks/os2/proc_mutex.c b/locks/os2/proc_mutex.c index 23f0bdd69..3a3c848aa 100644 --- a/locks/os2/proc_mutex.c +++ b/locks/os2/proc_mutex.c @@ -93,6 +93,11 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *vmutex) 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"; diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index 2f2a1a626..1fc630c38 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -877,6 +877,18 @@ APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) 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 */ diff --git a/locks/win32/proc_mutex.c b/locks/win32/proc_mutex.c index 37a1d0cec..b490299ff 100644 --- a/locks/win32/proc_mutex.c +++ b/locks/win32/proc_mutex.c @@ -205,6 +205,11 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) 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; |