Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* RPC from 32 bit to 64 bit
@ 1996-10-13  4:00 Brian Bowman
  1996-10-18  4:00 ` Eric Werme
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Bowman @ 1996-10-13  4:00 UTC (permalink / raw)



I'm having problems porting some RPC code to an ALPHA running OSF1. I 
keep getting an error 1734 which is error in array bounds. The problem 
occurrs when calling a function with an argument which is a pointer to a 
structure. Any suggestions or clues very much appreciated. I've been on 
this problem for a week and its driving me nuts !

Brian




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RPC from 32 bit to 64 bit
  1996-10-13  4:00 RPC from 32 bit to 64 bit Brian Bowman
@ 1996-10-18  4:00 ` Eric Werme
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Werme @ 1996-10-18  4:00 UTC (permalink / raw)



Brian Bowman <brian.bowman@dial.pipex.com> writes:

>I'm having problems porting some RPC code to an ALPHA running OSF1. I 
>keep getting an error 1734 which is error in array bounds. The problem 
>occurrs when calling a function with an argument which is a pointer to a 
>structure. Any suggestions or clues very much appreciated. I've been on 
>this problem for a week and its driving me nuts !

Error 1734?  What language are you using?  What libraries are you using?
What follows pertains solely to the RPC routines in libc.a.  I can't tell
if this applies to your problem.

From a HTML-ized Digital UNIX FAW at
http://www.eecis.udel.edu/~carver/digital_unix_faq.html
What's wrong with xdr_long in the Digital UNIX XDR routines? 

xdr_long is used for sending signed 32-bit values and cannot send
0xFFFFFFFF. xdr_ulong should be used instead. For 64-bit integer
values, use xdr_hyper. See the manual pages for more details.

[Curtis Keller, curtis@kinesix.com]

This is slightly misleading. xdr_long() can send -1, which in 32 bits
is 0xffffffff. xdr_long() does range checking, insuring that the top
33 bits of its 64-bit argument are all ones or all zeroes. If this is
not the case, then the signed long integer is beyond the range of
representation within a signed 32-bit value, and xdr_long() rightly
fails.

xdr_u_long() [note typo above!] insures that the top 32 bits of its
64-bit argument are all zero. If this is not the case, then the
unsigned long integer is beyond ... blah blah.

So, the upshot is: If you're using signed values, use xdr_long(), and
DON'T use unsigned constants like 0xffffffff to set variables. If
you're using unsigned values, use xdr_u_long(). In both cases, make
sure you're within range for 32-bits, if you want to interoperate with
32-bit machines using native data types.

[John Kohl,jtk@atria.com]

From "man xdr_long":
  Differences Between xdr_long and xdr_hyper Routines

  On Digital UNIX platforms, the C programming language and the XDR routines
  apply different conventions to the definitions of the long data type.

  On Digital UNIX platforms, the C programming language applies the following
  conventions for int and long data types:

  __________________________
  Data Type   bits   bytes
  __________________________
  int         32     4 bytes

  long        64     8 bytes
  __________________________

  The XDR routines apply the following conventions:

  __________________________
  Data Type   bits   bytes
  __________________________
  int         32     4 bytes

  long        32     4 bytes

  hyper       64     8 bytes
  __________________________

  The xdr_long() and xdr_u_long() interfaces serialize 4 bytes of data. The
  xdr_hyper() and xdr_u_hyper() serialize 8 bytes of data.

  On Digital UNIX systems, the second argument to both xdr_long and xdr_hyper
  must be either a pointer or of the C language type long (8 bytes).  When
  xdr_hyper is called with a parameter that points to a long all 8-bytes are
  serialized.  In contrast, when xdr_long is called with a parameter that
  points to a long only the low order 4-bytes are serialized.

  When calling xdr_long on the DECODE operation, the upper 4-bytes of the
  long are sign extended in accordance with the high order bit of the lower
  4-byte quantity. This is necessary to maintain the XDR convention of
  xdr_long serializing 4-bytes.

  If you want all 8-bytes to be serialized, use the xdr_hyper interface.

  The xdr_longlong_t and the xdr_u_longlong_t perform the same function as
  the xdr_hyper and the xdr_u_hyper interfaces respectively.
-- 
  <>    Eric (Ric) Werme   <>  Why Government Doesn't Work!  For details   <>
  <>  <werme@zk3.dec.com>  <>     visit http://www.HarryBrowne96.org/      <>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-10-18  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-10-13  4:00 RPC from 32 bit to 64 bit Brian Bowman
1996-10-18  4:00 ` Eric Werme

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