[Spread-users] Portability bug on SOLARIS 8, sparcv9 (64-bit)

Daniel Rall dlr at finemaltcoding.com
Thu Nov 7 12:46:09 EST 2002


Theo Schlossnagle <jesus at omniti.com> writes:

> I did the original port to Alpha/Linux on a 64 bit machine and I had
> it  running on Solaris 8 (64-bit).  It is possible that the autoconf
> changes I made backed out some of the 64bit changes.  I don't remember
> changing the iovec -- perhaps on linux that is not a size_t....  The
> biggest issue with 64bit was that the sp_time structure used {int int}
> instead of {long long}.

Here is iovec for Linux 2.4, from include/linux/uio.h:

struct iovec
{
        void *iov_base;         /* BSD uses caddr_t (1003.1g requires void *) */        __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
};

> Luckily, determining this sort of thing at compile time is _super_
> easy  with autoconf.  So a solid, portable fix should be easy.

Would it be difficult to typedef scat_element to the native iovec
struct?

> On Thursday, Nov 7, 2002, at 05:10 US/Eastern, James Rauser wrote:
> 
> > Hello,
> >
> > I just ran into a problem compiling spread on 64-bit Solaris 8
> > (sparcv9).
> 
> > In scatter.h, the structure "scat_element" is defined as:
> >
> > 	/* scat_element is EXACTLY as defined in iovec */
> > 	typedef struct dummy_scat_element{
> > 		char	*buf;
> > 		int	len;
> > 	} scat_element;
> >
> > The comment is important pointers to arrays of scat_element are cast
> > to (struct iovec *) and plugged into the msg.msg_iov pointer
> > (struct msghdr) in DL_send().
> >
> > But: on Solaris, struct iovec uses "size_t" for the length field, and
> > on sparcv9, int is 32 bits and size_t is 64.  Ooops...  This causes
> > the sendmsg() calls in DL_send to fail with EMSGSIZE, with the result
> > that clients don't get any messages.
> >
> > This happens in both 3.16.2 and 3.17.0.
> >
> > I changed the len field to use "size_t" and the daemon appears to work
> > normally after a few basic tests.
> >
> > I was surprised by this because a search through the mailing list
> > archives turns up several messages which claim to have spread running
> > on 64-bit sparc and Linux Alpha without problems.  Is spread
> > "officially"
> 
> > tested on 64-bit architectures?
> >
> > Greetings, Jim
> >
> > --
> 
> > ----------------------------------------------------------------------- 
> > -
> > Jim Rauser                                          Science Factory
> > GmbH
> 
> > mailto:j.rauser at science-factory.com                       Unter
> > Käster  1
> 
> > Tel: +49 221 277 399 204                          50667 Cologne,
> > Germany
> 
> >
> > _______________________________________________
> > Spread-users mailing list
> > Spread-users at lists.spread.org
> > http://lists.spread.org/mailman/listinfo/spread-users
> 
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
> 

-- 

Daniel Rall <dlr at finemaltcoding.com>




More information about the Spread-users mailing list