Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!clyde!cbatt!cwruecmp!hal!ncoast!tdi2!brandon From: brandon@tdi2.UUCP (Brandon Allbery) Newsgroups: comp.unix.wizards Subject: casting args to functions... Message-ID: <115@tdi2.UUCP> Date: Mon, 10-Nov-86 17:59:33 EST Article-I.D.: tdi2.115 Posted: Mon Nov 10 17:59:33 1986 Date-Received: Tue, 11-Nov-86 21:59:22 EST References: <1376@batcomputer.TN.CORNELL.EDU> <840@ur-valhalla.UUCP> <5068@ukme.ukma.uky.csnet> Reply-To: brandon@tdi2.UUCP (Brandon Allbery) Followup-To: net.unix-wizards Organization: Tridelta Industries, Inc., Mentor, OH Lines: 32 Expires: Quoted from <5068@ukme.ukma.uky.csnet> ["Re: Microport Unix -- Large Model Problems"], by david@ukma.uky.csnet (David Herron, NPR Lover)... +--------------- | 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! +--------------- The problem is not this: it is that ioctl() is documented as taking a pointer in some places and as taking an int in others. Please note that it is not documented as taking a union, or is the "int" changed to a "long" on machines with 2-byte integers and 4-byte pointers. Berkeley int==long-ism strikes again! ++Brandon -- /-----------//***/ Brandon S. Allbery cbosgd!cwruecmp!ncoast!allbery /--- -----//***/ Tridelta Industries, Inc. ihnp4!tft2!tdi2!brandon / //---, /---/ 7350 Corporate Blvd. !ncoast!allbery / // / / / Mentor, OH 44060 /--//---' /---/ +1 216 255 1080 HOME: +1 216 974 9210