Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!rutgers!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <5299@brl-smoke.ARPA> Date: Sat, 8-Nov-86 03:16:50 EST Article-I.D.: brl-smok.5299 Posted: Sat Nov 8 03:16:50 1986 Date-Received: Sun, 9-Nov-86 03:38:23 EST References: <1376@batcomputer.TN.CORNELL.EDU> <840@ur-valhalla.UUCP> <5068@ukme.ukma.uky.csnet> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 In article <5068@ukme.ukma.uky.csnet> david@ukme.UUCP (David Herron, NPR Lover) writes: -In article <840@ur-valhalla.UUCP> dave@valhalla.UUCP (Dave Carlson) writes: ->A potential problem I smacked into yesterday when porting BSD to SV/AT ->is ioctl(2) expects as the third argument: ->union { int iarg; -> char *cparg;} ->Problem is that the union will pull 4 bytes off the stack (in large model) ->but the program calling with an integer will only push 2 bytes. Oh S*$&! ->I cast my integer args long and everything seems ok but what a pain... - -Argh! And you're doing a port of an operating system??? - -UNIONS are the SAME size regardless of WHICH part of them you use! - -A user which passes an int to a routine expecting a union is ASKING -for trouble! Oh, good grief! Mr. Carlson is talking about ioctl(), which is a well-known function whose third argument has a type that depends on its second argument's value; usually it's an (int) or a (struct termio *). The problem is not his; rather it is due to the SV/AT implementor changing ioctl()'s third argument to be a union. This is in violation of the SVID and of common sense, since (as Mr. Carlson reports) this breaks correctly-written code.