64 bit problems in cvs -- hangs after some fixes

Randy Kunkee randy at randallkunkee.com
Wed Sep 25 19:36:35 EDT 2002


I'm trying to get imapd running on a 64 bit (Alpha, Tru 64 4.0g).  First
thing is that it segfaults.  Unfortunately, although my programs no
longer segfault, the server hangs on my test imap port without any
greeting.  I'm using the CVS version of imapd, along with sasl2.1.6, and
openssl-0.9.6d.  In my /etc/cyrus.conf I've commented out the servers
(from small.conf) except for imapd, which I'm having listen on an
alternate port (since I have an older imapd in service on the system).

This seems to fix things a 64 bit problem in mpool.c (though I can't yet
claim success, and these changes are likely not compatible with 32 bit
systems).  Incidentally, the comment in mpool_malloc says round to 8
bytes, but the code rounded to 16.  I changed this to 8, since that is
the boundary for an alpha (and most other machines).

Randy


Index: mpool.c
===================================================================
RCS file: /cvs/src/cyrus/lib/mpool.c,v
retrieving revision 1.8
diff -u -r1.8 mpool.c
--- mpool.c     2002/07/26 23:12:26     1.8
+++ mpool.c     2002/09/25 23:24:04
@@ -125,7 +125,7 @@
 #endif

 /* bump to the next multiple of 8 bytes */
-#define ROUNDUP(num) (((num) + 15) & 0xFFFFFFF0)
+#define ROUNDUP(num) (((num) + 7) & 0xFFFFFFFFFFFFFFF8)

 /* Allocate from a pool */
 void *mpool_malloc(struct mpool *pool, size_t size)
@@ -161,7 +161,7 @@
     }

     ret = p->ptr;
-    p->ptr = (void *)ROUNDUP((unsigned int)p->ptr + size);
+    p->ptr = (void *)ROUNDUP((unsigned long)p->ptr + size);

     return ret;
 }

On an alpha, the int truncates to 32 bits, which is a no-no, since all
pointers are 64 bits.

Also, saslauthd had a similar problem as the lib/retry.c, ie. using a
void *buf as though it were a char *:

Index: retry.c
===================================================================
RCS file: /cvs/src/cyrus/lib/retry.c,v
retrieving revision 1.16
diff -u -r1.16 retry.c
--- retry.c     2002/04/23 20:47:44     1.16
+++ retry.c     2002/09/25 23:24:04
@@ -58,8 +58,9 @@
  * Keep calling the read() system call with 'fd', 'buf', and 'nbyte'
  * until all the data is read in or an error occurs.
  */
-int retry_read(int fd, void *buf, size_t nbyte)
+int retry_read(int fd, void *vbuf, size_t nbyte)
 {
+    char *buf = vbuf;
     int n;
     int nread = 0;


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/info-cyrus/attachments/20020925/8dbb516d/attachment.html


More information about the Info-cyrus mailing list