sizes of objects in large model

Chad Gibbons chad at lakesys.UUCP
Wed Mar 15 05:40:43 AEST 1989


	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) */
};

	In addition, the struct login is referenced.  Here is that:

struct login {
	short	ln_tty;		/* login terminal I/O channel */
	short	ln_playpid;	/* login play process pid */
	short	ln_readpid;	/* login read process pid */
	char	ln_name[8+1];	/* login name */
	char	*ln_term;	/* login terminal name */
				/* login trm. characteristics */
	char	*ln_tcm,*ln_tcl,*ln_tce,*ln_tso,*ln_tse;
	char	ln_rvslh;	/* login reverse low/high screen display */
	char	ln_iomode;	/* login I/O mode */
	char	ln_crft[12+1];	/* login craft name */
	idxptr	ln_play;	/* login is playing */
	char	ln_stat;	/* login status (major command) */
	char	*ln_substat;	/* login substatus (command dependent) */
	char	ln_input[79+1];	/* login input buffer */
};

	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.

Mail responses only, if you please.
-- 
D. Chadwick Gibbons, chad at lakesys.lakesys.com, ...!uunet!marque!lakesys!chad



More information about the Comp.unix.xenix mailing list