RPC/XDR experience?

Olof Johansson olof at austin.ibm.com
Sat Jun 7 08:17:28 EST 2003

linas at austin.ibm.com wrote:
> Anyone out there with experience with RPC on 64 bit machines?
> I've got a 'hello-world' RPC program that falls apart when
> compiled & linked to 64-bit glibc on PPC64.  It doesn't like
> long ints.  I'm getting the feeling that I may be opening a
> pandora's box; I'm hoping that someone will reply and state
> that no, 64-bit RPC's work great on alphas and sparcs and mips,
> and not to worry ...


As far as I can tell it works just fine.

Notice however, that the implementation of xdr_long WILL fail for cases where it's found that the
64-bit long contains larger (or smaller, for negative) values than can be stored in the 32-bit
over-the-wire long. This might give surprising results when you're using xdr_long to encode an
unsigned integer.

See code snippet:

xdr_long (XDR *xdrs, long *lp)

   if (xdrs->x_op == XDR_ENCODE
       && (sizeof (int32_t) == sizeof (long)
           || (int32_t) *lp == *lp))             //   <--  HERE is the check
     return XDR_PUTLONG (xdrs, lp);

   return FALSE;


Olof Johansson                                        Office: 4E002/905
pSeries Linux Development                             IBM Systems Group
Email: olof at austin.ibm.com                          Phone: 512-838-9858
All opinions are my own and not those of IBM

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/

More information about the Linuxppc64-dev mailing list