Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!udel!udccvax1!evh From: evh@vax1.acs.udel.EDU (Troy Saville) Newsgroups: comp.unix.xenix Subject: Re: sizes of objects in large model Message-ID: <3090@udccvax1.acs.udel.EDU> Date: 15 Mar 89 02:12:08 GMT References: <462@lakesys.UUCP> Reply-To: evh@vax1.acs.udel.EDU (Troy Saville) Distribution: usa Organization: University of Delaware Lines: 45 Mail bounced, so..... In article <462@lakesys.UUCP> chad@lakesys.UUCP (Chad Gibbons) writes: > > I was having problems getting a program to work correctly under >SCO XENIX/286 V2.2.3. The program works as expected on the 386 version >of the same OS. It won't work because of same changes in pointer sizes >in the large model program. The program, by the way, is Spacewar, if >that provides anyone any insight on how to get around this size problem. > > The progam relies on two different structures being the same >size. Here are the definitions for the two structures: > >struct uio { > struct login far *uio_lgn; /* user i/o pointer to login struct */ > char uio_chrs[16]; /* user i/o characters */ >}; > >struct uio2 { > int uio2sig; /* signal, 0 for logon */ > short uio2pid; /* process-id of playsw */ > char uio2tty[14]; /* ttyname for logon (signal 0 only) */ >}; > ...deleted... > > In a small model program, sizeof() reports 20 for both uio >structures. In a large model (which the program must be to compile) the >first uio struct is 20, and the second, uio2, is 18. > > Any ideas on how to perhaps fix this? In general, some >information on generting portable programs across memory models would be >helpful, not to mention any hints on how to get this monster program to >compiled. > >D. Chadwick Gibbons, chad@lakesys.lakesys.com, ...!uunet!marque!lakesys!chad I don't know if this will effect the program, but I would pad the end of the uio2 structure with 2 chars, or change the length of uio2tty from 14 to 16. This size difference is a problem with the compiler. I've used said xenix compiler and my opinion is that its poorly written. I've had so many problems with it, but the list is long so I won't bother printing it.