From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1064b0b019242d0f X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-03-13 09:37:06 PST Newsgroups: comp.unix.osf.osf1 Path: gmd.de!newsserver.jvnc.net!yale.edu!noc.near.net!atria.com!jtk From: jtk@atria.com (John T. Kohl) Subject: Re: Under what conditions do xdr_long work? In-Reply-To: marsj@ida.liu.se's message of Fri, 11 Mar 1994 18:01:29 GMT Message-ID: Sender: news@atria.com Nntp-Posting-Host: banana.atria.com Organization: Atria Software, Inc. References: <1994Mar11.180129.3253@ida.liu.se> Date: Sun, 13 Mar 1994 17:37:06 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 or working for but not representing: Atria Software --------- Oh, just enjoy yourself!