You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ji...@apache.org on 2002/06/07 16:04:35 UTC

cvs commit: apr/locks/win32 proc_mutex.c

jim         2002/06/07 07:04:34

  Modified:    .        CHANGES
               include  apr_proc_mutex.h
               include/arch/unix 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:
  Added 2 additional lock functions: apr_proc_mutex_name and
  apr_proc_mutex_defname which returns the type name of the mutex
  (eg: "sysvsem") as well as the default mutex type (APR_LOCK_DEFAULT).
  Mostly useful under Unix were the locktypes are selectable.
  
  apr_proc_mutex_name takes a *apr_proc_mutex_t argument, whereas
  apr_proc_mutex_defname takes (and requires) none. For those systems
  that don't have selectable mutex types, I've "thought up" names
  that made sense... feel free to modify :)
  
  Revision  Changes    Path
  1.293     +6 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.292
  retrieving revision 1.293
  diff -u -r1.292 -r1.293
  --- CHANGES	29 May 2002 22:08:43 -0000	1.292
  +++ CHANGES	7 Jun 2002 14:04:33 -0000	1.293
  @@ -1,5 +1,11 @@
   Changes with APR b1
   
  +  *) Added 2 additional lock functions: apr_proc_mutex_name and
  +     apr_proc_mutex_defname which returns the type name of the mutex
  +     (eg: "sysvsem") as well as the default mutex type (APR_LOCK_DEFAULT).
  +     Mostly useful under Unix were the locktypes are selectable.
  +     [Jim Jagielski]
  +
     *) Fixed apr_generate_random_bytes() for Win32 on Win NT or 9x by
        dropping the 0x40 bit (CRYPT_SILENT) for earlier OS'es.
        PR 9286  [William Rowe]
  
  
  
  1.8       +13 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_proc_mutex.h	9 Apr 2002 06:56:55 -0000	1.7
  +++ apr_proc_mutex.h	7 Jun 2002 14:04:34 -0000	1.8
  @@ -151,6 +151,19 @@
   APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(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
  + */
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex);
  +
  +/**
  + * Display the name of the default mutex: APR_LOCK_DEFAULT
  + * @param mutex the name of the default mutex
  + */
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void);
  +
  +/**
    * Get the pool used by this proc_mutex.
    * @return apr_pool_t the pool
    */
  
  
  
  1.8       +1 -0      apr/include/arch/unix/proc_mutex.h
  
  Index: proc_mutex.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/proc_mutex.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- proc_mutex.h	16 May 2002 12:18:10 -0000	1.7
  +++ proc_mutex.h	7 Jun 2002 14:04:34 -0000	1.8
  @@ -113,6 +113,7 @@
       apr_status_t (*release)(apr_proc_mutex_t *);
       apr_status_t (*destroy)(apr_proc_mutex_t *);
       apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
  +    const char *name;
   };
   typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t;
   
  
  
  
  1.8       +10 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- proc_mutex.c	13 Mar 2002 20:39:20 -0000	1.7
  +++ proc_mutex.c	7 Jun 2002 14:04:34 -0000	1.8
  @@ -157,6 +157,16 @@
       return stat;
   }
   
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  +{
  +    return "beossem";
  +}
  +
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void)
  +{
  +    return "beossem";
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
   
   /* Implement OS-specific accessors defined in apr_portable.h */
  
  
  
  1.8       +10 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- proc_mutex.c	13 Mar 2002 20:39:20 -0000	1.7
  +++ proc_mutex.c	7 Jun 2002 14:04:34 -0000	1.8
  @@ -115,6 +115,16 @@
       return APR_ENOLOCK;
   }
   
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  +{
  +    return "netwarethread";
  +}
  +
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void)
  +{
  +    return "netwarethread";
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
   
   /* Implement OS-specific accessors defined in apr_portable.h */
  
  
  
  1.9       +9 -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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- proc_mutex.c	13 Mar 2002 20:39:21 -0000	1.8
  +++ proc_mutex.c	7 Jun 2002 14:04:34 -0000	1.9
  @@ -93,6 +93,15 @@
       return apr_proc_mutex_destroy(mutex);
   }
   
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  +{
  +    return "os2sem";
  +}
  +
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void)
  +{
  +    return "os2sem";
  +}
   
   
   APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
  
  
  
  1.18      +28 -5     apr/locks/unix/proc_mutex.c
  
  Index: proc_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- proc_mutex.c	9 May 2002 18:56:43 -0000	1.17
  +++ proc_mutex.c	7 Jun 2002 14:04:34 -0000	1.18
  @@ -177,7 +177,8 @@
       NULL, /* no tryacquire */
       proc_mutex_posix_release,
       proc_mutex_posix_destroy,
  -    proc_mutex_posix_child_init
  +    proc_mutex_posix_child_init,
  +    "posixsem"
   };
   
   #endif /* Posix sem implementation */
  @@ -292,7 +293,8 @@
       NULL, /* no tryacquire */
       proc_mutex_sysv_release,
       proc_mutex_sysv_destroy,
  -    proc_mutex_sysv_child_init
  +    proc_mutex_sysv_child_init,
  +    "sysvsem"
   };
   
   #endif /* SysV sem implementation */
  @@ -466,7 +468,8 @@
       NULL, /* no tryacquire */
       proc_mutex_proc_pthread_release,
       proc_mutex_proc_pthread_destroy,
  -    proc_mutex_proc_pthread_child_init
  +    proc_mutex_proc_pthread_child_init,
  +    "pthread"
   };
   
   #endif
  @@ -601,7 +604,8 @@
       NULL, /* no tryacquire */
       proc_mutex_fcntl_release,
       proc_mutex_fcntl_destroy,
  -    proc_mutex_fcntl_child_init
  +    proc_mutex_fcntl_child_init,
  +    "fcntl"
   };
   
   #endif /* fcntl implementation */
  @@ -730,7 +734,8 @@
       NULL, /* no tryacquire */
       proc_mutex_flock_release,
       proc_mutex_flock_destroy,
  -    proc_mutex_flock_child_init
  +    proc_mutex_flock_child_init,
  +    "flock"
   };
   
   #endif /* flock implementation */
  @@ -813,6 +818,19 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void)
  +{
  +    apr_status_t rv;
  +    apr_proc_mutex_t mutex;
  +
  +    if ((rv = proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT)) != APR_SUCCESS) {
  +        return "unknown";
  +    }
  +    mutex.meth = mutex.inter_meth;
  +
  +    return apr_proc_mutex_name(&mutex);
  +}
  +   
   static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech, const char *fname)
   {
       apr_status_t rv;
  @@ -933,6 +951,11 @@
   APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex)
   {
       return mutex->meth->destroy(mutex);
  +}
  +
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  +{
  +    return mutex->meth->name;
   }
   
   APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
  
  
  
  1.9       +10 -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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- proc_mutex.c	13 Mar 2002 20:39:22 -0000	1.8
  +++ proc_mutex.c	7 Jun 2002 14:04:34 -0000	1.9
  @@ -176,6 +176,16 @@
       return stat;
   }
   
  +APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex)
  +{
  +    return "win32mutex";
  +}
  +
  +APR_DECLARE(const char *) apr_proc_mutex_defname(void)
  +{
  +    return "win32mutex";
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex)
   
   /* Implement OS-specific accessors defined in apr_portable.h */