diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2001-12-29 23:14:22 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2001-12-29 23:14:22 +0000 |
commit | 4f9f87c87fa9ec66b2574f14fa454099e6e0f17f (patch) | |
tree | ccd3de96eba5c37b36a3b2b4f2438d151757188a /locks | |
parent | 715322934f6467641f88031f401014ab02491962 (diff) | |
download | libapr-4f9f87c87fa9ec66b2574f14fa454099e6e0f17f.tar.gz |
roll the extra apr_lock_create_np() functionality into apr_lock_create()
and get rid of apr_lock_create_np(); apr_lock_create() has a new
parameter for specifying the lock mechanism (or APR_LOCK_DEFAULT to let
APR choose)
(same for apr_proc_mutex_create_np() and apr_proc_mutex_create())
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62684 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r-- | locks/beos/locks.c | 10 | ||||
-rw-r--r-- | locks/beos/proc_mutex.c | 15 | ||||
-rw-r--r-- | locks/netware/locks.c | 6 | ||||
-rw-r--r-- | locks/netware/proc_mutex.c | 9 | ||||
-rw-r--r-- | locks/os2/locks.c | 8 | ||||
-rw-r--r-- | locks/os2/proc_mutex.c | 11 | ||||
-rw-r--r-- | locks/unix/locks.c | 17 | ||||
-rw-r--r-- | locks/unix/proc_mutex.c | 21 | ||||
-rw-r--r-- | locks/win32/locks.c | 5 | ||||
-rw-r--r-- | locks/win32/proc_mutex.c | 9 |
10 files changed, 39 insertions, 72 deletions
diff --git a/locks/beos/locks.c b/locks/beos/locks.c index 443664742..2c29a50a4 100644 --- a/locks/beos/locks.c +++ b/locks/beos/locks.c @@ -274,12 +274,16 @@ static apr_status_t _destroy_lock(apr_lock_t *lock) } APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type, - apr_lockscope_e scope, const char *fname, - apr_pool_t *pool) + apr_lockscope_e scope, apr_lockmech_e mech, + const char *fname, apr_pool_t *pool) { apr_lock_t *new; apr_status_t stat = APR_SUCCESS; - + + if (mech != APR_LOCK_DEFAULT) { + return APR_ENOTIMPL; + } + new = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t)); if (new == NULL){ return APR_ENOMEM; diff --git a/locks/beos/proc_mutex.c b/locks/beos/proc_mutex.c index bb4d403f3..94e6d8893 100644 --- a/locks/beos/proc_mutex.c +++ b/locks/beos/proc_mutex.c @@ -79,11 +79,16 @@ static apr_status_t _proc_mutex_cleanup(void * data) APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, const char *fname, + apr_lockmech_e mech, apr_pool_t *pool) { apr_proc_mutex_t *new; apr_status_t stat = APR_SUCCESS; + if (mech != APR_LOCK_DEFAULT) { + return APR_ENOTIMPL; + } + new = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t)); if (new == NULL){ return APR_ENOMEM; @@ -104,16 +109,6 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, return APR_SUCCESS; } -#if APR_HAS_CREATE_LOCKS_NP -APR_DECLARE(apr_status_t) apr_proc_mutex_create_np(apr_proc_mutex_t **mutex, - const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} -#endif - APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, const char *fname, apr_pool_t *pool) diff --git a/locks/netware/locks.c b/locks/netware/locks.c index 71bf356e7..0238761db 100644 --- a/locks/netware/locks.c +++ b/locks/netware/locks.c @@ -76,7 +76,7 @@ static apr_status_t lock_cleanup(void *lock_) } apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_lockscope_e scope, - const char *fname, apr_pool_t *pool) + apr_lockmech_e mech, const char *fname, apr_pool_t *pool) { apr_lock_t *newlock = NULL; @@ -95,6 +95,10 @@ apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_locksco apr_status_t status; long flags = 0; + if (mech != APR_LOCK_DEFAULT) { + return APR_ENOTIMPL; + } + newlock = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t)); if(newlock ==NULL) { diff --git a/locks/netware/proc_mutex.c b/locks/netware/proc_mutex.c index b8d02663c..190332893 100644 --- a/locks/netware/proc_mutex.c +++ b/locks/netware/proc_mutex.c @@ -61,19 +61,12 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, const char *fname, + apr_lockmech_e mech, apr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create_np(apr_proc_mutex_t **mutex, - const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} - APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, const char *fname, apr_pool_t *pool) diff --git a/locks/os2/locks.c b/locks/os2/locks.c index 71f58a9b5..0d6abb19d 100644 --- a/locks/os2/locks.c +++ b/locks/os2/locks.c @@ -72,8 +72,8 @@ static apr_status_t lock_cleanup(void *thelock) APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type, - apr_lockscope_e scope, const char *fname, - apr_pool_t *pool) + apr_lockscope_e scope, apr_lockmech_e mech, + const char *fname, apr_pool_t *pool) { apr_lock_t *new; ULONG rc; @@ -84,6 +84,10 @@ APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type if (type == APR_READWRITE) return APR_ENOTIMPL; + if (mech != APR_LOCK_DEFAULT) { + return APR_ENOTIMPL; + } + new = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t)); new->pool = pool; diff --git a/locks/os2/proc_mutex.c b/locks/os2/proc_mutex.c index 3612b7916..82714c30d 100644 --- a/locks/os2/proc_mutex.c +++ b/locks/os2/proc_mutex.c @@ -62,21 +62,12 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, const char *fname, + apr_lockmech_e mech, apr_pool_t *pool) { return APR_ENOTIMPL; } -#if APR_HAS_LOCK_CREATE_NP -APR_DECLARE(apr_status_t) apr_proc_mutex_create_np(apr_proc_mutex_t **mutex, - const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} -#endif - APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, const char *fname, apr_pool_t *pool) diff --git a/locks/unix/locks.c b/locks/unix/locks.c index 7e5d3b69e..ac2bc0d73 100644 --- a/locks/unix/locks.c +++ b/locks/unix/locks.c @@ -128,7 +128,7 @@ static const struct apr_unix_lock_methods_t lockall_methods = lockall_child_init }; -static apr_status_t choose_method(apr_lock_t *new, apr_lockmech_e_np mech) +static apr_status_t choose_method(apr_lock_t *new, apr_lockmech_e mech) { switch (mech) { case APR_LOCK_FCNTL: @@ -178,7 +178,7 @@ static apr_status_t choose_method(apr_lock_t *new, apr_lockmech_e_np mech) return APR_SUCCESS; } -static apr_status_t create_lock(apr_lock_t *new, apr_lockmech_e_np mech, const char *fname) +static apr_status_t create_lock(apr_lock_t *new, apr_lockmech_e mech, const char *fname) { apr_status_t stat; @@ -230,9 +230,9 @@ static apr_status_t create_lock(apr_lock_t *new, apr_lockmech_e_np mech, const c return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_lock_create_np(apr_lock_t **lock, apr_locktype_e type, - apr_lockscope_e scope, apr_lockmech_e_np mech, - const char *fname, apr_pool_t *pool) +APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type, + apr_lockscope_e scope, apr_lockmech_e mech, + const char *fname, apr_pool_t *pool) { apr_lock_t *new; apr_status_t stat; @@ -253,13 +253,6 @@ APR_DECLARE(apr_status_t) apr_lock_create_np(apr_lock_t **lock, apr_locktype_e t return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type, - apr_lockscope_e scope, const char *fname, - apr_pool_t *pool) -{ - return apr_lock_create_np(lock, type, scope, APR_LOCK_DEFAULT, fname, pool); -} - APR_DECLARE(apr_status_t) apr_lock_acquire(apr_lock_t *lock) { apr_status_t stat; diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index 60569d9f7..a9513506f 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -624,15 +624,7 @@ void apr_proc_mutex_unix_setup_lock(void) #endif } - - - - - - - - -static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lockmech_e_np mech) +static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech) { switch (mech) { case APR_LOCK_FCNTL: @@ -682,7 +674,7 @@ static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lo return APR_SUCCESS; } -static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_e_np mech, const char *fname) +static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech, const char *fname) { apr_status_t rv; @@ -703,16 +695,9 @@ static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, const char *fname, + apr_lockmech_e mech, apr_pool_t *pool) { - return apr_proc_mutex_create_np(mutex, fname, APR_LOCK_DEFAULT, pool); -} - -APR_DECLARE(apr_status_t) apr_proc_mutex_create_np(apr_proc_mutex_t **mutex, - const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) -{ apr_proc_mutex_t *new_mutex; apr_status_t rv; diff --git a/locks/win32/locks.c b/locks/win32/locks.c index 7a8457676..1730a4a34 100644 --- a/locks/win32/locks.c +++ b/locks/win32/locks.c @@ -85,6 +85,7 @@ static apr_status_t lock_cleanup(void *lock_) APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_lockscope_e scope, + apr_lockmech_e mech, const char *fname, apr_pool_t *pool) { @@ -95,6 +96,10 @@ APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock, if (type == APR_READWRITE) return APR_ENOTIMPL; + if (mech != APR_LOCK_DEFAULT) { + return APR_ENOTIMPL; + } + newlock = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t)); newlock->pool = pool; diff --git a/locks/win32/proc_mutex.c b/locks/win32/proc_mutex.c index 54167e1d2..c37362eb7 100644 --- a/locks/win32/proc_mutex.c +++ b/locks/win32/proc_mutex.c @@ -61,19 +61,12 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, const char *fname, + apr_lockmech_e mech, apr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create_np(apr_proc_mutex_t **mutex, - const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} - APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, const char *fname, apr_pool_t *pool) |