Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: jtk@atria.com (John T. Kohl)
Subject: Re: Under what conditions do xdr_long work?
Date: Sun, 13 Mar 1994 17:37:06 GMT	[thread overview]
Message-ID: <CMM69u.3K6@atria.com> (raw)
In-Reply-To: marsj@ida.liu.se's message of Fri, 11 Mar 1994 18:01:29 GMT

I recently did the bulk of the work in porting my company's product to
DEC OSF/1 on Alpha AXP.  This was our first 64-bit architecture.
Here's what I determined about the behaviour of the XDR routines on DEC
OSF/1 V1.3:

(a) xdr_{u_,}long in user space takes a pointer to a long.  It encodes/decodes
from/to that long.

If it's encoding, it range-checks the value.
	* If xdr_long, the top 33 bits must be all zeros or ones.  (if
	this is not the case, the value will lose precision when stuffed
	into a 32-bit XDR encoding).
	* If xdr_u_long, the top 32 bits must be clear.
        * practical import:
	  (i) do not xdr_long or xdr_u_long pointers. They won't fit.
	  (ii) don't xdr_long or xdr_u_long uninitialized or otherwise
	  garbage long/u_long values (e.g. random numbers).  They
	  probably won't fit.
	  (iii) You will get an XDR failure if the range check fails, so
	  it's fairly simple to find the offending out-of-range item.

If it's decoding, it zero-fills (u_long) or sign-extends (long) the top
32 bits.

(b) xdr_{u_,}long in the kernel take pointers to int (in V1.3, at
least).  If you have longs in kernel RPC code, you'll need to roll your
own xdr_*long routines to do the range-checking and zero/sign extending.
--
John Kohl <jtk@atria.com> or <jtkohl@mit.edu>
working for but not representing:	Atria Software
---------
Oh, just enjoy yourself!


  reply	other threads:[~1994-03-13 17:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-03-11 18:01 Under what conditions do xdr_long work? Martin Sjolin
1994-03-13 17:37 ` John T. Kohl [this message]
1994-03-14 19:55 ` Eric Werme USSG
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox