home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.admin:6202 comp.sys.sun.misc:4135
- 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
- From: schorr@ead.dsa.com (Andrew J. Schorr)
- Newsgroups: comp.sys.sun.admin,comp.sys.sun.misc
- Subject: SunOS 4.1.2 XDR alignment requirements?
- Keywords: SunOS XDR alignment
- Message-ID: <1992Sep8.135138@ead.dsa.com>
- Date: 8 Sep 92 17:51:38 GMT
- Sender: news@ead.dsa.com
- Organization: Daiwa Securities America, New York
- Lines: 55
-
- It appears (although this is undocumented) that the
- buffer supplied in a call to xdrmem_create must be
- aligned on a 4-byte boundary. On a SparcStation 1
- running SunOS 4.1.2, consider the following session script:
-
- schorr@dead: cat xdr.c
- #include <rpc/rpc.h>
-
- main()
- {
- int x;
- char buf[100];
- XDR xdr;
-
- #define OFFSET 1
-
- xdrmem_create(&xdr,&buf[OFFSET],sizeof(buf)-OFFSET,XDR_ENCODE);
- printf("%d\n",xdr_int(&xdr,&x));
- }
- schorr@dead: Gmake xdr
- # Must update dependencies for 1 files; using cc...
- # altered files: ../xdr.c
- # updatedep: processing xdr.o
- cc -g -I/usr/local/X11R5/include -I/extras/local/X11R5/include
- -I/usr/local
- /include -I/homes/lib/eadtools -D_NO_PROTO -I/homes/schorr/src/disp
- -I/homes/
- rtp/cur/include -L/usr/local/X11R5/lib -L/usr/local/lib -o xdr
- ../xdr.c
- schorr@dead: xdr
- Bus error (core dumped)
- schorr@dead: dbx sun4/xdr
- Reading symbolic information...
- Read 164 symbols
- warning: core file read error: address not in data space
- program terminated by signal BUS (alignment error)
- (dbx) where
- warning: core file read error: address not in data space
- xdrmem_putlong() at 0xf7731430
- xdr_int() at 0xf77309f0
- main(), line 12 in "sun4/../xdr.c"
- (dbx) quit
-
- Please note that the same program runs fine on an IBM RS/6000
- running AIX 3.2. Apparently xdrmem_putlong is assuming that the
- target buffer is 4-byte aligned. The same thing happens when
- decoding (except the crash is in xdrmem_getlong).
-
- Does anyone have any thoughts on this? It seems to me that this violates
- the XDR spec. Does anyone know if this is fixed in Solaris 2.0?
-
- Please respond by e-mail since my news feed is down. I will summarize
- if there is interest.
-
- -Andy
-