apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: APR_HAS_CREATE_LOCKS_NP not defined where it should be
Date Sat, 29 Dec 2001 21:48:12 GMT
Justin Erenkrantz <jerenkrantz@ebuilt.com> writes:

> On Sat, Dec 29, 2001 at 09:49:23AM -0500, Jeff Trawick wrote:
> > I would prefer moving to a situation where the function that allows
> > you to specify the implementation is always available and
> > APR_LOCK_DEFAULT is always available.
> > 
> > One way to do that:
> > 
> > . get rid of apr_lock_create_np() and apr_proc_mutex_create_np()
> > 
> > . add new required parameter to apr_lock_create() and
> >   apr_proc_mutex_create() for specifying implementation (expecting
> >   most callers to pass APR_LOCK_DEFAULT)
> 
> I was about to say the same thing (even had a message written last
> night to that effect).  So, +1.  -- justin

This patch would seem to implement this:

Index: include/mpm_common.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/mpm_common.h,v
retrieving revision 1.30
diff -u -r1.30 mpm_common.h
--- include/mpm_common.h	17 Nov 2001 14:02:25 -0000	1.30
+++ include/mpm_common.h	29 Dec 2001 21:46:46 -0000
@@ -254,7 +254,7 @@
  * The system mutex implementation to use for the accept mutex.
  */
 #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
-extern apr_lockmech_e_np ap_accept_lock_mech;
+extern apr_lockmech_e ap_accept_lock_mech;
 const char *ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy,
                                         const char *arg);
 #endif
Index: modules/aaa/mod_auth_digest.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/aaa/mod_auth_digest.c,v
retrieving revision 1.55
diff -u -r1.55 mod_auth_digest.c
--- modules/aaa/mod_auth_digest.c	29 Dec 2001 03:34:33 -0000	1.55
+++ modules/aaa/mod_auth_digest.c	29 Dec 2001 21:46:49 -0000
@@ -364,7 +364,7 @@
 
     tmpnam(client_lock_name);
     sts = apr_lock_create(&client_lock, APR_READWRITE, APR_LOCKALL,
-                         client_lock_name, ctx);
+                          APR_LOCK_DEFAULT, client_lock_name, ctx);
     if (sts != APR_SUCCESS) {
         log_error_and_cleanup("failed to create lock", sts, s);
         return;
@@ -382,7 +382,7 @@
 
     tmpnam(opaque_lock_name);
     sts = apr_lock_create(&opaque_lock, APR_MUTEX, APR_LOCKALL,
-                          opaque_lock_name, ctx);
+                          APR_LOCK_DEFAULT, opaque_lock_name, ctx);
     if (sts != APR_SUCCESS) {
         log_error_and_cleanup("failed to create lock", sts, s);
         return;
Index: modules/mappers/mod_rewrite.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.90
diff -u -r1.90 mod_rewrite.c
--- modules/mappers/mod_rewrite.c	23 Nov 2001 16:35:22 -0000	1.90
+++ modules/mappers/mod_rewrite.c	29 Dec 2001 21:46:51 -0000
@@ -941,8 +941,8 @@
     proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
 
     /* create the rewriting lockfiles in the parent */
-    if ((rv = apr_lock_create (&rewrite_log_lock, APR_MUTEX, APR_LOCKALL,
-                               NULL, p)) != APR_SUCCESS) {
+    if ((rv = apr_lock_create(&rewrite_log_lock, APR_MUTEX, APR_LOCKALL,
+                              APR_LOCK_DEFAULT, NULL, p)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
                      "mod_rewrite: could not create rewrite_log_lock");
         return HTTP_INTERNAL_SERVER_ERROR;
@@ -3266,7 +3266,8 @@
     lockname = ap_server_root_relative(p, lockname);
 
     /* create the lockfile */
-    rc = apr_lock_create (&rewrite_mapr_lock_acquire, APR_MUTEX, APR_LOCKALL, lockname,
p);
+    rc = apr_lock_create(&rewrite_mapr_lock_acquire, APR_MUTEX, APR_LOCKALL, 
+                         APR_LOCK_DEFAULT, lockname, p);
     if (rc != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
                      "mod_rewrite: Parent could not create RewriteLock "
Index: modules/ssl/ssl_engine_mutex.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/ssl/ssl_engine_mutex.c,v
retrieving revision 1.6
diff -u -r1.6 ssl_engine_mutex.c
--- modules/ssl/ssl_engine_mutex.c	19 Jul 2001 16:08:01 -0000	1.6
+++ modules/ssl/ssl_engine_mutex.c	29 Dec 2001 21:46:51 -0000
@@ -68,7 +68,7 @@
 
     if (mc->nMutexMode == SSL_MUTEXMODE_NONE) 
         return TRUE;
-    if (apr_lock_create(&mc->pMutex, APR_MUTEX, APR_LOCKALL, 
+    if (apr_lock_create(&mc->pMutex, APR_MUTEX, APR_LOCKALL, APR_LOCK_DEFAULT,
                         mc->szMutexFile, p) != APR_SUCCESS)
         return FALSE;
     return TRUE;
Index: server/mpm_common.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.76
diff -u -r1.76 mpm_common.c
--- server/mpm_common.c	18 Dec 2001 13:48:52 -0000	1.76
+++ server/mpm_common.c	29 Dec 2001 21:46:52 -0000
@@ -603,7 +603,7 @@
 #endif
 
 #ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
-apr_lockmech_e_np ap_accept_lock_mech = APR_LOCK_DEFAULT;
+apr_lockmech_e ap_accept_lock_mech = APR_LOCK_DEFAULT;
 AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd,
 						     void *dummy,
 						     const char *arg)
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.74
diff -u -r1.74 beos.c
--- server/mpm/beos/beos.c	18 Dec 2001 13:48:53 -0000	1.74
+++ server/mpm/beos/beos.c	29 Dec 2001 21:46:53 -0000
@@ -813,7 +813,7 @@
      * in select at a time
      */
     if ((rv = apr_lock_create(&accept_mutex, APR_MUTEX, APR_CROSS_PROCESS,
-        NULL, pconf)) != APR_SUCCESS) {
+                              APR_LOCK_DEFAULT, NULL, pconf)) != APR_SUCCESS) {
         /* tsch tsch, can't have more than one thread in the accept loop
            at a time so we need to fall on our sword... */
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
@@ -825,7 +825,7 @@
      * locks the worker_thread_count so we have ana ccurate count...
      */
     if ((rv = apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_CROSS_PROCESS,
-        NULL, pconf)) != APR_SUCCESS) {
+                              APR_LOCK_DEFAULT, NULL, pconf)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create worker thread count lock");
         return 1;
Index: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.96
diff -u -r1.96 perchild.c
--- server/mpm/perchild/perchild.c	23 Dec 2001 14:22:36 -0000	1.96
+++ server/mpm/perchild/perchild.c	29 Dec 2001 21:46:54 -0000
@@ -1012,15 +1012,15 @@
     }
     apr_pool_create(&thread_pool_parent, pchild);
     apr_lock_create(&thread_pool_parent_mutex, APR_MUTEX, APR_INTRAPROCESS, 
-                    NULL, pchild);
+                    APR_LOCK_DEFAULT, NULL, pchild);
     apr_lock_create(&idle_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS, 
-                    NULL, pchild);
+                    APR_LOCK_DEFAULT, NULL, pchild);
     apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS,
-                    NULL, pchild);
+                    APR_LOCK_DEFAULT, NULL, pchild);
     apr_lock_create(&pipe_of_death_mutex, APR_MUTEX, APR_INTRAPROCESS,
-                    NULL, pchild);
+                    APR_LOCK_DEFAULT, NULL, pchild);
     apr_lock_create(&thread_accept_mutex, APR_MUTEX, APR_INTRAPROCESS,
-                    NULL, pchild);
+                    APR_LOCK_DEFAULT, NULL, pchild);
 
     apr_threadattr_create(&worker_thread_attr, pchild);
     apr_threadattr_detach_set(worker_thread_attr, 1);                                   
 
@@ -1295,9 +1295,9 @@
     ap_lock_fname = apr_psprintf(_pconf, "%s.%u",
                                  ap_server_root_relative(_pconf, ap_lock_fname),
                                  my_pid);
-    rv = SAFE_ACCEPT(apr_lock_create_np(&process_accept_mutex, APR_MUTEX,
-                                        APR_CROSS_PROCESS, ap_accept_lock_mech,
-                                        ap_lock_fname, _pconf));
+    rv = SAFE_ACCEPT(apr_lock_create(&process_accept_mutex, APR_MUTEX,
+                                     APR_CROSS_PROCESS, ap_accept_lock_mech,
+                                     ap_lock_fname, _pconf));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create cross-process lock");
Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.226
diff -u -r1.226 prefork.c
--- server/mpm/prefork/prefork.c	19 Dec 2001 14:49:22 -0000	1.226
+++ server/mpm/prefork/prefork.c	29 Dec 2001 21:46:55 -0000
@@ -265,8 +265,8 @@
     apr_status_t rv;
 
     expand_lock_fname(p);
-    rv = apr_lock_create_np(&accept_lock, APR_MUTEX, APR_CROSS_PROCESS, 
-                            ap_accept_lock_mech, ap_lock_fname, p);
+    rv = apr_lock_create(&accept_lock, APR_MUTEX, APR_CROSS_PROCESS, 
+                         ap_accept_lock_mech, ap_lock_fname, p);
     if (rv) {
 	ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't create accept mutex");
         exit(APEXIT_INIT);
Index: server/mpm/spmt_os2/spmt_os2.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/spmt_os2/spmt_os2.c,v
retrieving revision 1.112
diff -u -r1.112 spmt_os2.c
--- server/mpm/spmt_os2/spmt_os2.c	18 Dec 2001 13:48:53 -0000	1.112
+++ server/mpm/spmt_os2/spmt_os2.c	29 Dec 2001 21:46:56 -0000
@@ -187,7 +187,8 @@
  */
 static void accept_mutex_init(apr_pool_t *p)
 {
-    apr_status_t rc = apr_lock_create(&accept_mutex, APR_MUTEX, APR_INTRAPROCESS, NULL,
p);
+    apr_status_t rc = apr_lock_create(&accept_mutex, APR_MUTEX, APR_INTRAPROCESS, 
+                                      APR_LOCK_DEFAULT, NULL, p);
 
     if (rc != APR_SUCCESS) {
 	ap_log_error(APLOG_MARK, APLOG_EMERG, rc, ap_server_conf,
Index: server/mpm/winnt/mpm_winnt.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.202
diff -u -r1.202 mpm_winnt.c
--- server/mpm/winnt/mpm_winnt.c	18 Dec 2001 13:48:53 -0000	1.202
+++ server/mpm/winnt/mpm_winnt.c	29 Dec 2001 21:46:58 -0000
@@ -988,7 +988,7 @@
     if (one_process) {
         /* Single process mode */
         apr_lock_create(&start_mutex, APR_MUTEX, APR_CROSS_PROCESS,
-                        signal_name_prefix, pconf);
+                        APR_LOCK_DEFAULT, signal_name_prefix, pconf);
         exit_event = CreateEvent(NULL, TRUE, FALSE, exit_event_name);
     }
     else {
@@ -1013,7 +1013,8 @@
     ap_run_child_init(pchild, ap_server_conf);
     
     allowed_globals.jobsemaphore = CreateSemaphore(NULL, 0, 1000000, NULL);
-    apr_lock_create(&allowed_globals.jobmutex, APR_MUTEX, APR_INTRAPROCESS, NULL, pchild);
+    apr_lock_create(&allowed_globals.jobmutex, APR_MUTEX, APR_INTRAPROCESS, 
+                    APR_LOCK_DEFAULT, NULL, pchild);
 
     /*
      * Wait until we have permission to start accepting connections.
@@ -1040,7 +1041,8 @@
                                                     NULL,
                                                     0,
                                                     0); /* CONCURRENT ACTIVE THREADS */
-        apr_lock_create(&qlock, APR_MUTEX, APR_INTRAPROCESS, NULL, pchild);
+        apr_lock_create(&qlock, APR_MUTEX, APR_INTRAPROCESS, APR_LOCK_DEFAULT, 
+                        NULL, pchild);
     }
 
     /* 
@@ -1993,8 +1995,9 @@
              * Ths start mutex is used during a restart to prevent more than one 
              * child process from entering the accept loop at once.
              */
-            apr_lock_create(&start_mutex,APR_MUTEX, APR_CROSS_PROCESS, signal_name_prefix,
-                               ap_server_conf->process->pool);
+            apr_lock_create(&start_mutex,APR_MUTEX, APR_CROSS_PROCESS, 
+                            APR_LOCK_DEFAULT, signal_name_prefix, 
+                            ap_server_conf->process->pool);
         }
     }
     else /* parent_pid != my_pid */
Index: server/mpm/worker/mpm.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/worker/mpm.h,v
retrieving revision 1.7
diff -u -r1.7 mpm.h
--- server/mpm/worker/mpm.h	25 Dec 2001 02:30:53 -0000	1.7
+++ server/mpm/worker/mpm.h	29 Dec 2001 21:46:58 -0000
@@ -73,9 +73,7 @@
 #define AP_MPM_WANT_SET_LOCKFILE
 #define AP_MPM_WANT_SET_MAX_REQUESTS
 #define AP_MPM_WANT_SET_COREDUMPDIR
-#if APR_HAS_CREATE_LOCKS_NP
 #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
-#endif /* APR_HAS_CREATE_LOCKS_NP */
 #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
 
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
Index: server/mpm/worker/worker.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/worker/worker.c,v
retrieving revision 1.57
diff -u -r1.57 worker.c
--- server/mpm/worker/worker.c	29 Dec 2001 17:36:17 -0000	1.57
+++ server/mpm/worker/worker.c	29 Dec 2001 21:47:00 -0000
@@ -1399,20 +1399,14 @@
                                  ap_server_root_relative(_pconf, ap_lock_fname),
                                  ap_my_pid);
 
-#if APR_HAS_CREATE_LOCKS_NP
-    rv = apr_proc_mutex_create_np(&accept_mutex, ap_lock_fname, 
-                                  ap_accept_lock_mech, _pconf);
-#else
-    rv = apr_proc_mutex_create(&accept_mutex, ap_lock_fname, _pconf);
-#endif /* APR_HAS_CREATE_LOCKS_NP */
-
+    rv = apr_proc_mutex_create(&accept_mutex, ap_lock_fname, 
+                               ap_accept_lock_mech, _pconf);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create accept lock");
         return 1;
     }
 
-#if APR_HAS_CREATE_LOCKS_NP
 #if APR_USE_SYSVSEM_SERIALIZE
     if (ap_accept_lock_mech == APR_LOCK_DEFAULT || 
         ap_accept_lock_mech == APR_LOCK_SYSVSEM) {
@@ -1426,7 +1420,6 @@
             return 1;
         }
     }
-#endif /* APR_HAS_CREATE_LOCKS_NP */
 
     if (!is_graceful) {
         ap_run_pre_mpm(pconf, SB_SHARED);
Index: srclib/apr/file_io/os2/open.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/os2/open.c,v
retrieving revision 1.45
diff -u -r1.45 open.c
--- srclib/apr/file_io/os2/open.c	10 Aug 2001 21:04:47 -0000	1.45
+++ srclib/apr/file_io/os2/open.c	29 Dec 2001 21:47:00 -0000
@@ -99,7 +99,8 @@
 
     if (dafile->buffered) {
         dafile->buffer = apr_palloc(cntxt, APR_FILE_BUFSIZE);
-        rv = apr_lock_create(&dafile->mutex, APR_MUTEX, APR_INTRAPROCESS, NULL, cntxt);
+        rv = apr_lock_create(&dafile->mutex, APR_MUTEX, APR_INTRAPROCESS, 
+                             APR_LOCK_DEFAULT, NULL, cntxt);
 
         if (rv)
             return rv;
Index: srclib/apr/include/apr_lock.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_lock.h,v
retrieving revision 1.30
diff -u -r1.30 apr_lock.h
--- srclib/apr/include/apr_lock.h	17 Aug 2001 03:54:04 -0000	1.30
+++ srclib/apr/include/apr_lock.h	29 Dec 2001 21:47:00 -0000
@@ -80,6 +80,9 @@
 
 typedef enum {APR_READER, APR_WRITER} apr_readerwriter_e;
 
+typedef enum {APR_LOCK_FCNTL, APR_LOCK_FLOCK, APR_LOCK_SYSVSEM, APR_LOCK_PROC_PTHREAD,
+              APR_LOCK_DEFAULT} apr_lockmech_e;
+
 typedef struct apr_lock_t    apr_lock_t;
 
 /*   Function definitions */
@@ -99,16 +102,27 @@
  *            APR_LOCKALL          lock processes and threads from the
  *                                 protected area.
  * </PRE>
+ * @param mech The mechanism to use for the interprocess lock, if any; one of
+ * <PRE>
+ *            APR_LOCK_FCNTL
+ *            APR_LOCK_FLOCK
+ *            APR_LOCK_SYSVSEM
+ *            APR_LOCK_PROC_PTHREAD
+ *            APR_LOCK_DEFAULT     pick the default mechanism for the platform
+ * </PRE>
  * @param fname A file name to use if the lock mechanism requires one.  This
  *        argument should always be provided.  The lock code itself will
  *        determine if it should be used.
  * @param pool The pool to operate on.
  * @warning APR_CROSS_PROCESS may lock both processes and threads, but it is
  *          only guaranteed to lock processes.
+ * @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
+ *          APR_LOCK_foo.  Only APR_LOCK_DEFAULT is portable.
  */
 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);
 
@@ -184,52 +198,6 @@
                                            const char *key,
                                            apr_status_t (*cleanup)(void *));
 
-#if APR_HAS_LOCK_CREATE_NP
-
-typedef enum {APR_LOCK_FCNTL, APR_LOCK_FLOCK, APR_LOCK_SYSVSEM, APR_LOCK_PROC_PTHREAD,
-              APR_LOCK_DEFAULT} apr_lockmech_e_np;
-
-/**
- * non-portable interface to apr_lock_create()
- *
- * Create a new instance of a lock structure.  This is like apr_lock_create()
- * but has some non-portable parameters.  This should be used sparingly.
- *
- * @param lock The newly created lock structure.
- * @param type The type of lock to create, one of:
- * <PRE>
- *            APR_MUTEX
- *            APR_READWRITE
- * </PRE>
- * @param scope The scope of the lock to create, one of:
- * <PRE>
- *            APR_CROSS_PROCESS    lock processes from the protected area.
- *            APR_INTRAPROCESS     lock threads from the protected area.
- *            APR_LOCKALL          lock processes and threads from the
- *                                 protected area.
- * </PRE>
- * @param mech The mechanism to use for the interprocess lock, if any; one of
- * <PRE>
- *            APR_LOCK_FCNTL
- *            APR_LOCK_FLOCK
- *            APR_LOCK_SYSVSEM
- *            APR_LOCK_PROC_PTHREAD
- *            APR_LOCK_DEFAULT     pick the default mechanism for the platform
- * </PRE>
- * @param fname A file name to use if the lock mechanism requires one.  This
- *        argument should always be provided.  The lock code itself will
- *        determine if it should be used.
- * @param pool The pool to operate on.
- * @warning APR_CROSS_PROCESS may lock both processes and threads, but it is
- *          only guaranteed to lock processes.
- */
-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);
-#endif /* APR_HAS_LOCK_CREATE_NP */
 /** @} */
 #ifdef __cplusplus
 }
Index: srclib/apr/include/apr_proc_mutex.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_proc_mutex.h,v
retrieving revision 1.3
diff -u -r1.3 apr_proc_mutex.h
--- srclib/apr/include/apr_proc_mutex.h	29 Sep 2001 05:03:37 -0000	1.3
+++ srclib/apr/include/apr_proc_mutex.h	29 Dec 2001 21:47:00 -0000
@@ -86,21 +86,6 @@
  * @param fname A file name to use if the lock mechanism requires one.  This
  *        argument should always be provided.  The lock code itself will
  *        determine if it should be used.
- * @param pool the pool from which to allocate the mutex.
- */
-APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
-                                                const char *fname,
-                                                apr_pool_t *pool);
-
-/**
- * non-portable interface to apr_proc_mutex_create()
- *
- * Create and initialize a mutex that can be used to synchronize processes.
- * @param mutex the memory address where the newly created mutex will be
- *        stored.
- * @param fname A file name to use if the lock mechanism requires one.  This
- *        argument should always be provided.  The lock code itself will
- *        determine if it should be used.
  * @param mech The mechanism to use for the interprocess lock, if any; one of
  * <PRE>
  *            APR_LOCK_FCNTL
@@ -111,12 +96,10 @@
  * </PRE>
  * @param pool the pool from which to allocate the mutex.
  */
-#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);
-#endif
+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);
 
 /**
  * Re-open a mutex in a child process.
Index: srclib/apr/locks/beos/locks.c
===================================================================
RCS file: /home/cvspublic/apr/locks/beos/locks.c,v
retrieving revision 1.34
diff -u -r1.34 locks.c
--- srclib/apr/locks/beos/locks.c	10 Aug 2001 21:04:47 -0000	1.34
+++ srclib/apr/locks/beos/locks.c	29 Dec 2001 21:47:01 -0000
@@ -274,12 +274,16 @@
 }
 
 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;
Index: srclib/apr/locks/beos/proc_mutex.c
===================================================================
RCS file: /home/cvspublic/apr/locks/beos/proc_mutex.c,v
retrieving revision 1.5
diff -u -r1.5 proc_mutex.c
--- srclib/apr/locks/beos/proc_mutex.c	23 Dec 2001 13:06:40 -0000	1.5
+++ srclib/apr/locks/beos/proc_mutex.c	29 Dec 2001 21:47:01 -0000
@@ -79,11 +79,16 @@
 
 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;
@@ -103,16 +108,6 @@
     (*mutex) = new;
     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,
Index: srclib/apr/locks/netware/locks.c
===================================================================
RCS file: /home/cvspublic/apr/locks/netware/locks.c,v
retrieving revision 1.1
diff -u -r1.1 locks.c
--- srclib/apr/locks/netware/locks.c	6 Aug 2001 15:50:49 -0000	1.1
+++ srclib/apr/locks/netware/locks.c	29 Dec 2001 21:47:01 -0000
@@ -76,7 +76,7 @@
 }
 
 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;
@@ -94,6 +94,10 @@
 	NXLockInfo_t *info;			   //for libc NKS NXRwLockAlloc
     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));
 	
Index: srclib/apr/locks/netware/proc_mutex.c
===================================================================
RCS file: /home/cvspublic/apr/locks/netware/proc_mutex.c,v
retrieving revision 1.3
diff -u -r1.3 proc_mutex.c
--- srclib/apr/locks/netware/proc_mutex.c	19 Oct 2001 23:25:28 -0000	1.3
+++ srclib/apr/locks/netware/proc_mutex.c	29 Dec 2001 21:47:01 -0000
@@ -61,18 +61,11 @@
 
 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,
Index: srclib/apr/locks/os2/locks.c
===================================================================
RCS file: /home/cvspublic/apr/locks/os2/locks.c,v
retrieving revision 1.35
diff -u -r1.35 locks.c
--- srclib/apr/locks/os2/locks.c	10 Aug 2001 21:04:47 -0000	1.35
+++ srclib/apr/locks/os2/locks.c	29 Dec 2001 21:47:01 -0000
@@ -72,8 +72,8 @@
 
 
 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;
@@ -83,6 +83,10 @@
     /* FIXME: Remove when read write locks implemented. */
     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));
 
Index: srclib/apr/locks/os2/proc_mutex.c
===================================================================
RCS file: /home/cvspublic/apr/locks/os2/proc_mutex.c,v
retrieving revision 1.5
diff -u -r1.5 proc_mutex.c
--- srclib/apr/locks/os2/proc_mutex.c	29 Dec 2001 10:03:39 -0000	1.5
+++ srclib/apr/locks/os2/proc_mutex.c	29 Dec 2001 21:47:01 -0000
@@ -62,20 +62,11 @@
 
 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,
Index: srclib/apr/locks/unix/locks.c
===================================================================
RCS file: /home/cvspublic/apr/locks/unix/locks.c,v
retrieving revision 1.63
diff -u -r1.63 locks.c
--- srclib/apr/locks/unix/locks.c	24 Sep 2001 05:41:57 -0000	1.63
+++ srclib/apr/locks/unix/locks.c	29 Dec 2001 21:47:02 -0000
@@ -128,7 +128,7 @@
     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 @@
     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 @@
     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;
@@ -251,13 +251,6 @@
 
     *lock = new;
     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)
Index: srclib/apr/locks/unix/proc_mutex.c
===================================================================
RCS file: /home/cvspublic/apr/locks/unix/proc_mutex.c,v
retrieving revision 1.8
diff -u -r1.8 proc_mutex.c
--- srclib/apr/locks/unix/proc_mutex.c	25 Oct 2001 14:52:43 -0000	1.8
+++ srclib/apr/locks/unix/proc_mutex.c	29 Dec 2001 21:47:02 -0000
@@ -624,15 +624,7 @@
 #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 @@
     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,15 +695,8 @@
 
 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;
Index: srclib/apr/locks/win32/locks.c
===================================================================
RCS file: /home/cvspublic/apr/locks/win32/locks.c,v
retrieving revision 1.47
diff -u -r1.47 locks.c
--- srclib/apr/locks/win32/locks.c	27 Nov 2001 05:22:34 -0000	1.47
+++ srclib/apr/locks/win32/locks.c	29 Dec 2001 21:47:02 -0000
@@ -85,6 +85,7 @@
 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)
 {
@@ -94,6 +95,10 @@
     /* FIXME: Remove when read write locks implemented. */
     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));
 
Index: srclib/apr/locks/win32/proc_mutex.c
===================================================================
RCS file: /home/cvspublic/apr/locks/win32/proc_mutex.c,v
retrieving revision 1.3
diff -u -r1.3 proc_mutex.c
--- srclib/apr/locks/win32/proc_mutex.c	19 Oct 2001 23:25:28 -0000	1.3
+++ srclib/apr/locks/win32/proc_mutex.c	29 Dec 2001 21:47:02 -0000
@@ -61,15 +61,8 @@
 
 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;
 }
Index: srclib/apr/shmem/unix/shmem.c
===================================================================
RCS file: /home/cvspublic/apr/shmem/unix/shmem.c,v
retrieving revision 1.33
diff -u -r1.33 shmem.c
--- srclib/apr/shmem/unix/shmem.c	30 Aug 2001 17:11:04 -0000	1.33
+++ srclib/apr/shmem/unix/shmem.c	29 Dec 2001 21:47:03 -0000
@@ -209,7 +209,8 @@
     new_m->curmem = mem;
     new_m->length = reqsize;
 
-    apr_lock_create(&new_m->lock, APR_MUTEX, APR_CROSS_PROCESS, NULL, pool);
+    apr_lock_create(&new_m->lock, APR_MUTEX, APR_CROSS_PROCESS, 
+                    APR_LOCK_DEFAULT, NULL, pool);
     if (!new_m->lock)
         return APR_EGENERAL;
 
Index: srclib/apr/test/testlock.c
===================================================================
RCS file: /home/cvspublic/apr/test/testlock.c,v
retrieving revision 1.15
diff -u -r1.15 testlock.c
--- srclib/apr/test/testlock.c	2 Dec 2001 14:02:16 -0000	1.15
+++ srclib/apr/test/testlock.c	29 Dec 2001 21:47:03 -0000
@@ -267,7 +267,7 @@
     printf("RW Lock Tests\n");
     printf("%-60s", "    Initializing the RW lock");
     s1 = apr_lock_create(&thread_rw_lock, APR_READWRITE, APR_INTRAPROCESS,
-                         "lock.file", pool);
+                         APR_LOCK_DEFAULT, "lock.file", pool);
     if (s1 != APR_SUCCESS) {
         printf("Failed!\n");
         return s1;
@@ -315,7 +315,7 @@
     printf("Exclusive lock test\n");
     printf("%-60s", "    Initializing the lock");
     s1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, 
-                         "lock.file", pool); 
+                         APR_LOCK_DEFAULT, "lock.file", pool); 
 
     if (s1 != APR_SUCCESS) {
         printf("Failed!\n");
@@ -363,8 +363,8 @@
  
     printf("Testing multiple locking\n");
     printf("%-60s","    Creating the lock we'll use");
-    if ((rv = apr_lock_create(&multi, APR_MUTEX, APR_LOCKALL, lockfile,
-                        pool)) != APR_SUCCESS) {
+    if ((rv = apr_lock_create(&multi, APR_MUTEX, APR_LOCKALL, APR_LOCK_DEFAULT,
+                              lockfile, pool)) != APR_SUCCESS) {
         printf("Failed!\n");
         return rv;
     }
Index: srclib/apr/test/testlockperf.c
===================================================================
RCS file: /home/cvspublic/apr/test/testlockperf.c,v
retrieving revision 1.5
diff -u -r1.5 testlockperf.c
--- srclib/apr/test/testlockperf.c	17 Oct 2001 00:33:00 -0000	1.5
+++ srclib/apr/test/testlockperf.c	29 Dec 2001 21:47:04 -0000
@@ -154,8 +154,8 @@
 
     printf("apr_lock(INTRAPROCESS, MUTEX) Lock Tests\n");
     printf("%-60s", "    Initializing the apr_lock_t");
-    s1 = apr_lock_create(&inter_lock, APR_MUTEX, APR_INTRAPROCESS,
-                         "lock.file", pool);
+    s1 = apr_lock_create(&inter_lock, APR_MUTEX, APR_INTRAPROCESS, 
+                         APR_LOCK_DEFAULT, "lock.file", pool);
     if (s1 != APR_SUCCESS) {
         printf("Failed!\n");
         return s1;
@@ -305,7 +305,7 @@
     printf("apr_lock(INTRAPROCESS, READWRITE) Lock Tests\n");
     printf("%-60s", "    Initializing the apr_lock_t");
     s1 = apr_lock_create(&inter_rwlock, APR_READWRITE, APR_INTRAPROCESS,
-                         "lock.file", pool);
+                         APR_LOCK_DEFAULT, "lock.file", pool);
     if (s1 != APR_SUCCESS) {
         printf("Failed!\n");
         return s1;
Index: srclib/apr/test/testprocmutex.c
===================================================================
RCS file: /home/cvspublic/apr/test/testprocmutex.c,v
retrieving revision 1.5
diff -u -r1.5 testprocmutex.c
--- srclib/apr/test/testprocmutex.c	23 Oct 2001 17:30:08 -0000	1.5
+++ srclib/apr/test/testprocmutex.c	29 Dec 2001 21:47:04 -0000
@@ -104,7 +104,7 @@
  
     printf("Exclusive lock test\n");
     printf("%-60s", "    Initializing the lock");
-    s1 = apr_proc_mutex_create(&proc_lock, lockname, pool);
+    s1 = apr_proc_mutex_create(&proc_lock, lockname, APR_LOCK_DEFAULT, pool);
  
     if (s1 != APR_SUCCESS) {
         printf("Failed!\n");
Index: srclib/apr/test/testthread.c
===================================================================
RCS file: /home/cvspublic/apr/test/testthread.c,v
retrieving revision 1.26
diff -u -r1.26 testthread.c
--- srclib/apr/test/testthread.c	27 Dec 2001 17:03:00 -0000	1.26
+++ srclib/apr/test/testthread.c	29 Dec 2001 21:47:04 -0000
@@ -129,7 +129,8 @@
     apr_thread_once_init(&control, context);
 
     printf("%-60s", "Initializing the lock"); 
-    r1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, "lock.file", context);

+    r1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, 
+                         APR_LOCK_DEFAULT, "lock.file", context); 
     if (r1 != APR_SUCCESS) {
         fflush(stdout);
         fprintf(stderr, "Failed\nCould not create lock\n");


-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message