Andy Fiddaman wrote:
On Fri, 7 Sep 2007, Ken Murchison wrote: ; We have been running 2.3.x code on 64-bit sparcv9 kernels (Solaris 8 on Sun ; Fire V240) without any problem. What is your hardware and OS? The test server is a Sun V210 running SunOS xxx 5.10 Generic_125100-10 sun4u sparc SUNW,Sun-Fire-V210 (Solaris 10u2 fully patched as of ~4 weeks ago) I've compiled Cyrus as a 64-bit application:
OK. I've talked to the folks that actually build our production code, and it turns out that we're still compiling Cyrus as a 32-bit app (don't ask me why, nobody has an answer).
Before I commit your patch, would you be willing to see if the attached alternate patch works?
This patch tries to force the entire buffer to be aligned, rather than aligning each 64-bit field individually. Don't know if this will work or not.
-- Kenneth Murchison Systems Programmer Project Cyrus Developer/Maintainer Carnegie Mellon University
Index: mailbox.c =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/imap/mailbox.c,v retrieving revision 1.170 diff -u -r1.170 mailbox.c --- mailbox.c 13 Sep 2007 20:49:53 -0000 1.170 +++ mailbox.c 14 Sep 2007 13:46:58 -0000 @@ -1291,7 +1291,13 @@ */ int mailbox_write_index_header(struct mailbox *mailbox) { - char buf[INDEX_HEADER_SIZE]; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char buf[INDEX_HEADER_SIZE]; + } align8buf; + char *buf = align8buf.buf; unsigned long header_size = sizeof(buf); int n; @@ -1396,7 +1402,13 @@ int sync) { int n; - char buf[INDEX_RECORD_SIZE]; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char buf[INDEX_RECORD_SIZE]; + } align8buf; + char *buf = align8buf.buf; mailbox_index_record_to_buf(record, buf); @@ -1431,7 +1443,14 @@ { unsigned i; int len, n; - char *buf, *p; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char *buf; + } align8buf; + char *buf = align8buf.buf; + char *p; long last_offset; time_t now = time(NULL); @@ -1530,8 +1549,14 @@ unsigned long exists; unsigned msgno; bit32 oldstart_offset, oldrecord_size, recsize_diff; - char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ? - INDEX_HEADER_SIZE : INDEX_RECORD_SIZE]; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ? + INDEX_HEADER_SIZE : INDEX_RECORD_SIZE]; + } align8buf; + char *buf = align8buf.buf; char *bufp; int quota_offset = 0; int calculate_flagcounts = 0; @@ -1859,8 +1884,14 @@ mailbox_decideproc_t *decideproc, void *deciderock, int expunge_flags) { - char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ? - INDEX_HEADER_SIZE : INDEX_RECORD_SIZE]; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ? + INDEX_HEADER_SIZE : INDEX_RECORD_SIZE]; + } align8buf; + char *buf = align8buf.buf; unsigned msgno; unsigned newexpunged; unsigned newexists; Index: mailbox.h =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/imap/mailbox.h,v retrieving revision 1.84 diff -u -r1.84 mailbox.h --- mailbox.h 5 Sep 2007 17:26:27 -0000 1.84 +++ mailbox.h 14 Sep 2007 13:46:58 -0000 @@ -104,7 +104,12 @@ const char *header_base; unsigned long header_len; - const char *index_base; + union { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + const char *index_base; + }; unsigned long index_len; /* mapped size */ const char *cache_base; unsigned long cache_len; /* mapped size */ Index: reconstruct.c =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/imap/reconstruct.c,v retrieving revision 1.96 diff -u -r1.96 reconstruct.c --- reconstruct.c 13 Sep 2007 20:21:38 -0000 1.96 +++ reconstruct.c 14 Sep 2007 13:46:58 -0000 @@ -704,8 +704,14 @@ */ int reconstruct(char *name, struct discovered *found) { - char buf[((INDEX_HEADER_SIZE > INDEX_RECORD_SIZE) ? - INDEX_HEADER_SIZE : INDEX_RECORD_SIZE)]; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + char buf[INDEX_HEADER_SIZE > INDEX_RECORD_SIZE ? + INDEX_HEADER_SIZE : INDEX_RECORD_SIZE]; + } align8buf; + char *buf = align8buf.buf; char quota_root[MAX_MAILBOX_PATH+1]; bit32 valid_user_flags[MAX_USER_FLAGS/32]; Index: sync_commit.c =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/imap/sync_commit.c,v retrieving revision 1.7 diff -u -r1.7 sync_commit.c --- sync_commit.c 12 Sep 2007 15:51:04 -0000 1.7 +++ sync_commit.c 14 Sep 2007 13:46:58 -0000 @@ -92,7 +92,13 @@ char *path; FILE *newindex = NULL; FILE *newcache = NULL; - unsigned char *buf = NULL; + struct { +#ifdef HAVE_LONG_LONG_INT + bit64 align8; +#endif + unsigned char *buf; + } align8buf; + unsigned char *buf = align8buf.buf = NULL; struct sync_upload_item *item; struct sync_message *message; quota_t quota_add = 0; /* Following may be negative on UUID conflict */
---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html