apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH] no core on tryacquire in locks/unix/proc_mutex.c
Date Wed, 19 Feb 2003 16:37:35 GMT
+1 here - we shouldn't be dispatching to NULL().

Bill

At 09:17 AM 2/19/2003, Chris Darroch wrote:
>Hi --
>
>   I'm re-submitting this patch because I think it just slipped
>to the bottom of the pile last time, but if it was rejected,
>just let me know and I'll stay silent on the subject in the future.
>
>   I happened to bump into the fact that the NULL pointers to
>the various tryacquire() functions in locks/unix/proc_mutex.c cause
>a core dump when apr_proc_mutex_trylock() function calls
>mutex->meth->tryacquire(mutex).  This patch is just to add stub
>tryacquire() functions and valid pointers to them, so that the
>caller gets a APR_ENOTIMPL value back.
>
>Chris.
>
>======================================
>
>--- proc_mutex.c.orig   2003-01-24 12:01:57.788054000 -0500
>+++ proc_mutex.c        2003-02-19 10:03:12.938309000 -0500
>@@ -144,6 +144,11 @@
>     return APR_SUCCESS;
> }
>
>+static apr_status_t proc_mutex_posix_tryacquire(apr_proc_mutex_t *mutex)
>+{
>+    return APR_ENOTIMPL;
>+}
>+
> static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex)
> {
>     int rc;
>@@ -171,7 +176,7 @@
> #endif
>     proc_mutex_posix_create,
>     proc_mutex_posix_acquire,
>-    NULL, /* no tryacquire */
>+    proc_mutex_posix_tryacquire,
>     proc_mutex_posix_release,
>     proc_mutex_posix_cleanup,
>     proc_mutex_posix_child_init,
>@@ -248,6 +253,11 @@
>     return APR_SUCCESS;
> }
>
>+static apr_status_t proc_mutex_sysv_tryacquire(apr_proc_mutex_t *mutex)
>+{
>+    return APR_ENOTIMPL;
>+}
>+
> static apr_status_t proc_mutex_sysv_release(apr_proc_mutex_t *mutex)
> {
>     int rc;
>@@ -276,7 +286,7 @@
> #endif
>     proc_mutex_sysv_create,
>     proc_mutex_sysv_acquire,
>-    NULL, /* no tryacquire */
>+    proc_mutex_sysv_tryacquire,
>     proc_mutex_sysv_release,
>     proc_mutex_sysv_cleanup,
>     proc_mutex_sysv_child_init,
>@@ -411,7 +421,10 @@
>     return APR_SUCCESS;
> }
>
>-/* TODO: Add proc_mutex_proc_pthread_tryacquire(apr_proc_mutex_t *mutex) */
>+static apr_status_t proc_mutex_proc_pthread_tryacquire(apr_proc_mutex_t
>*mutex)
>+{
>+    return APR_ENOTIMPL;
>+}
>
> static apr_status_t proc_mutex_proc_pthread_release(apr_proc_mutex_t
>*mutex)
> {
>@@ -439,7 +452,7 @@
>     APR_PROCESS_LOCK_MECH_IS_GLOBAL,
>     proc_mutex_proc_pthread_create,
>     proc_mutex_proc_pthread_acquire,
>-    NULL, /* no tryacquire */
>+    proc_mutex_proc_pthread_tryacquire,
>     proc_mutex_proc_pthread_release,
>     proc_mutex_proc_pthread_cleanup,
>     proc_mutex_proc_pthread_child_init,
>@@ -535,6 +548,11 @@
>     return APR_SUCCESS;
> }
>
>+static apr_status_t proc_mutex_fcntl_tryacquire(apr_proc_mutex_t *mutex)
>+{
>+    return APR_ENOTIMPL;
>+}
>+
> static apr_status_t proc_mutex_fcntl_release(apr_proc_mutex_t *mutex)
> {
>     int rc;
>@@ -565,7 +583,7 @@
> #endif
>     proc_mutex_fcntl_create,
>     proc_mutex_fcntl_acquire,
>-    NULL, /* no tryacquire */
>+    proc_mutex_fcntl_tryacquire,
>     proc_mutex_fcntl_release,
>     proc_mutex_fcntl_cleanup,
>     proc_mutex_fcntl_child_init,
>@@ -640,6 +658,11 @@
>     return APR_SUCCESS;
> }
>
>+static apr_status_t proc_mutex_flock_tryacquire(apr_proc_mutex_t *mutex)
>+{
>+    return APR_ENOTIMPL;
>+}
>+
> static apr_status_t proc_mutex_flock_release(apr_proc_mutex_t *mutex)
> {
>     int rc;
>@@ -685,7 +708,7 @@
> #endif
>     proc_mutex_flock_create,
>     proc_mutex_flock_acquire,
>-    NULL, /* no tryacquire */
>+    proc_mutex_flock_tryacquire,
>     proc_mutex_flock_release,
>     proc_mutex_flock_cleanup,
>     proc_mutex_flock_child_init,



Mime
View raw message