Am 16.10.2015 um 13:54 schrieb Yann Ylavic:
On Fri, Oct 16, 2015 at 10:02 AM, Yann Ylavic <ylavic....@gmail.com> wrote:
We should do something like the following patch:
Index: server/scoreboard.c
===================================================================
--- server/scoreboard.c (revision 1708095)
+++ server/scoreboard.c (working copy)
@@ -129,14 +129,19 @@ static apr_status_t ap_cleanup_shared_mem(void *d)
return APR_SUCCESS;
}
+#define SIZE_OF_scoreboard APR_ALIGN_DEFAULT(sizeof(scoreboard))
+#define SIZE_OF_global_score APR_ALIGN_DEFAULT(sizeof(global_score))
+#define SIZE_OF_process_score APR_ALIGN_DEFAULT(sizeof(process_score))
+#define SIZE_OF_worker_score APR_ALIGN_DEFAULT(sizeof(worker_score))
Maybe the following would be more correct:
+#define SCOREBOARD_ALIGN(size) APR_ALIGN((size),sizeof(void *))
+#define SIZE_OF_scoreboard SCOREBOARD_ALIGN(sizeof(scoreboard))
+#define SIZE_OF_global_score SCOREBOARD_ALIGN(sizeof(global_score))
+#define SIZE_OF_process_score SCOREBOARD_ALIGN(sizeof(process_score))
+#define SIZE_OF_worker_score SCOREBOARD_ALIGN(sizeof(worker_score))
since APR_ALIGN_DEFAULT seems to align to 8 bytes whatever the
platform requires...
Maybe some APR_ALIGN_NATIVE macro is missing in APR, like:
#define APR_ALIGN_NATIVE(size) APR_ALIGN((size), APR_SIZEOF_VOIDP)
but that's another story :)
I didn't yet have the time to reproduce and test your patch, but the
APR_ALIGN((size),sizeof(void *)) align approach would not work. The
problem here is that even or especially when building for 32 Bits and
then using a 64 Bit data type, the alignment fails. So the pointer size
would be 4 here, but the requirement alignment 8 bytes.
Fun with hardware.
Rainer