RPC/XDR experience?
linas at austin.ibm.com
linas at austin.ibm.com
Sat Jun 7 08:39:55 EST 2003
On Fri, Jun 06, 2003 at 05:17:28PM -0500, Olof Johansson wrote:
> 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 ...
>
> 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.
This is exactly what is happening.
> if (xdrs->x_op == XDR_ENCODE
> && (sizeof (int32_t) == sizeof (long)
> || (int32_t) *lp == *lp)) // <-- HERE is the check
OK, get ready:
I presume you pulled this from glibc sunrpc subdir? Or the kernel
rpc subdir? (The linux kernel rpc's can/should be different than
the glibc ones).
Is this a 'well known limitation'? (i.e. that xdr_long will only
send 32 bits), or is this a 'buggy implementation'?
If its 'well known', where is it documented? 'man xdr' gives no hint,
and implies the opposite is true ...
Does RPC define a 64-bit encoding (that can be received by 32-bit
servers)?
If so, shouldn't the xdr_long be modified to use the 64-bit marshalling?
I'm thinking to myself that there are valid reasons for applications
on 32-bit CPU's to use 64-bit ints. I know gcc handles 64-bit 'long-long
ints' on intel machines just fine, and has done so for at least 5 years.
(if not 10). By extension, one must conclude that there are valid
reasons for RPC's to support 64-bit ints, even on 32-bit arch's.
If you buy the argument in the last 3 sentances, then I would think
that xdr_long should be generating a 64-bit wire protocol on ppc64.
There. Pandora's box is now open ...
--linas
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list