Jeff Trawick <[EMAIL PROTECTED]> writes:
> Aaron Bannert <[EMAIL PROTECTED]> writes:
>
> > Could this be what's causing the SIGBUS? My current theory is that
> > there's a size mismatch betwen ws->conn_bytes (an apr_off_t) and
> > the (unsigned long) that only shows up on word-alignment-picky
> > chips like sparcs.
>
> I'm bombing today on Solaris/sparc trying to do
>
> ap_scoreboard_image->global->restart_time = apr_time_now()
>
> That field lives at 0x14 from the start of the page. I would suppose
> that there are alignment requirements that we aren't maintaining.
> ap_scoreboard_image->global is at 0x4 from the start of the page.
> Does anybody know about any documentation on alignment requirements?
> Should the shared memory code return storage on 8-byte alignment?
This patch gets me running again:
Index: srclib/apr/shmem/unix/shm.c
===================================================================
RCS file: /home/cvs/apr/shmem/unix/shm.c,v
retrieving revision 1.14
diff -u -r1.14 shm.c
--- srclib/apr/shmem/unix/shm.c 5 Feb 2002 04:32:52 -0000 1.14
+++ srclib/apr/shmem/unix/shm.c 1 Mar 2002 16:03:33 -0000
@@ -59,6 +59,12 @@
#include "apr_user.h"
#include "apr_strings.h"
+/* APR_ALIGN() is only to be used to align on a power of 2 boundary */
+#define APR_ALIGN(size, boundary) \
+ (((size) + ((boundary) - 1)) & ~((boundary) - 1))
+
+#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
+
static apr_status_t shm_cleanup_owner(void *m_)
{
apr_shm_t *m = (apr_shm_t *)m_;
@@ -189,7 +195,7 @@
/* store the real size in the metadata */
*(apr_size_t*)(new_m->base) = new_m->realsize;
/* metadata isn't usable */
- new_m->usable = (char *)new_m->base + sizeof(apr_size_t);
+ new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t));
apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner,
apr_pool_cleanup_null);
@@ -206,7 +212,7 @@
/* store the real size in the metadata */
*(apr_size_t*)(new_m->base) = new_m->realsize;
/* metadata isn't usable */
- new_m->usable = (char *)new_m->base + sizeof(apr_size_t);
+ new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t));
apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner,
apr_pool_cleanup_null);
@@ -345,7 +351,7 @@
/* store the real size in the metadata */
*(apr_size_t*)(new_m->base) = new_m->realsize;
/* metadata isn't usable */
- new_m->usable = (char *)new_m->base + sizeof(apr_size_t);
+ new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t));
apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner,
apr_pool_cleanup_null);
@@ -508,7 +514,7 @@
}
/* metadata isn't part of the usable segment */
- new_m->usable = (char *)new_m->base + sizeof(apr_size_t);
+ new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t));
apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_attach,
apr_pool_cleanup_null);
--
Jeff Trawick | [EMAIL PROTECTED] | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...