apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: apr_os_proc_mutex_get() segfault
Date Tue, 17 Jun 2014 21:57:17 GMT
Is there any chance this could be integrated into 1.6, or any fix that
allows apr_os_proc_mutex_put/get() on posix semaphores (sem_t)?

Regards,
Yann.

On Tue, Apr 15, 2014 at 12:37 AM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
> Also, it seems that the posix sems (ie. sem_t from semaphore.h) are
> handled as a file descriptor by apr_os_proc_mutex_get/set(), instead
> of the native sem_t.
>
> I tried to address all the issues related to proc_mutex (different)
> interfaces in the attached patch (v3, since v1 and v2 were already
> sent privatly to Jeff... I take this opportunity to modify
> slightly/accordingly the description below).
>
> I came up with this changes :
> 1. Add "sem_t *psem_interproc" to the end of the apr_os_proc_mutex_t
> struct (the only public API change),
> 2. Handle this new field in apr_os_proc_mutex_get/set() when
> APR_HAS_POSIXSEM_SERIALIZE,
> 3. Use "apr_os_proc_mutex_t *os" in the private unix(es)
> apr_proc_mutex_t struct instead of duplicating all its fields,
> 4. When the apr_proc_mutex_t's "apr_file_t *interproc" field is needed
> (only APR_HAS_FCNTL_SERIALIZE or APR_HAS_FLOCK_SERIALIZE now), set
> "os->crossproc = interproc->filedes" so that we can use only os'
> fields in all the native functions,
> 5. Depending on how the apr_proc_mutex_t->interproc was created
> (apr_proc_mutex_create()::apr_file_open() vs
> apr_os_proc_mutex_put()::apr_os_file_put() cases), we have to simply
> apr_file_close() the interproc or also close the os->crossproc (this
> is to keep consistency with others proc_mutex implementations which
> close/destroy their underlying OS objects on cleanup, whether
> _create() or _put() was used),
> 6. Fix the Netware and OS2 apr_os_proc_mutex_get() returned status,
> and implement apr_os_proc_mutex_set() on Netware.
> 7. Add static APR_INLINE apr_os_proc_mutex_reset() to reset the
> corresponding struct (NULL pointers, but mainly -1 for the file
> descriptor used by flock/fcntl), eg. before setting the only field to
> be used by apr_os_proc_mutex_put().
>
> For points 1 and 7, I don't know if this is backportable to 1.x, these
> are API changes...
> I can't tell either if the type of the os_mutex is needed in the
> struct (as a separate field), the doc could impose every field to be
> NULL/-1 but the used (native) type, or use 7 for that.

Mime
View raw message