home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / sun / admin / 6202 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.2 KB  |  68 lines

  1. Xref: sparky comp.sys.sun.admin:6202 comp.sys.sun.misc:4135
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!uwm.edu!ogicse!mintaka.lcs.mit.edu!ai-lab!dead!ead.dsa.com!schorr
  3. From: schorr@ead.dsa.com (Andrew J. Schorr)
  4. Newsgroups: comp.sys.sun.admin,comp.sys.sun.misc
  5. Subject: SunOS 4.1.2 XDR alignment requirements?
  6. Keywords: SunOS XDR alignment
  7. Message-ID: <1992Sep8.135138@ead.dsa.com>
  8. Date: 8 Sep 92 17:51:38 GMT
  9. Sender: news@ead.dsa.com
  10. Organization: Daiwa Securities America, New York
  11. Lines: 55
  12.  
  13. It appears (although this is undocumented) that the
  14. buffer supplied in a call to xdrmem_create must be
  15. aligned on a 4-byte boundary.  On a SparcStation 1
  16. running SunOS 4.1.2, consider the following session script:
  17.  
  18.    schorr@dead: cat xdr.c
  19.    #include <rpc/rpc.h>
  20.  
  21.    main()
  22.    {
  23.       int x;
  24.       char buf[100];
  25.       XDR xdr;
  26.  
  27.    #define OFFSET 1
  28.  
  29.       xdrmem_create(&xdr,&buf[OFFSET],sizeof(buf)-OFFSET,XDR_ENCODE);
  30.       printf("%d\n",xdr_int(&xdr,&x));
  31.    }
  32.    schorr@dead: Gmake xdr
  33.    # Must update dependencies for 1 files; using cc...
  34.    # altered files: ../xdr.c
  35.    # updatedep: processing xdr.o
  36.    cc -g   -I/usr/local/X11R5/include -I/extras/local/X11R5/include
  37. -I/usr/local
  38.    /include -I/homes/lib/eadtools -D_NO_PROTO -I/homes/schorr/src/disp
  39. -I/homes/
  40.    rtp/cur/include -L/usr/local/X11R5/lib -L/usr/local/lib   -o xdr
  41. ../xdr.c
  42.    schorr@dead: xdr
  43.    Bus error (core dumped)
  44.    schorr@dead: dbx sun4/xdr
  45.    Reading symbolic information...
  46.    Read 164 symbols
  47.    warning: core file read error: address not in data space
  48.    program terminated by signal BUS (alignment error)
  49.    (dbx) where
  50.    warning: core file read error: address not in data space
  51.    xdrmem_putlong() at 0xf7731430
  52.    xdr_int() at 0xf77309f0
  53.    main(), line 12 in "sun4/../xdr.c"
  54.    (dbx) quit
  55.  
  56. Please note that the same program runs fine on an IBM RS/6000
  57. running AIX 3.2.  Apparently xdrmem_putlong is assuming that the
  58. target buffer is 4-byte aligned.  The same thing happens when
  59. decoding (except the crash is in xdrmem_getlong).
  60.  
  61. Does anyone have any thoughts on this?  It seems to me that this violates
  62. the XDR spec.  Does anyone know if this is fixed in Solaris 2.0?
  63.  
  64. Please respond by e-mail since my news feed is down.  I will summarize
  65. if there is interest.
  66.  
  67. -Andy
  68.