From owner-freebsd-sparc64@FreeBSD.ORG Tue Sep 28 17:08:27 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1352416A4CE for ; Tue, 28 Sep 2004 17:08:27 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id C85F643D2D for ; Tue, 28 Sep 2004 17:08:26 +0000 (GMT) (envelope-from dhaigh@mail.com) Received: from wfilter.us4.outblaze.com (wfilter.us4.outblaze.com [205.158.62.180])7AF911801471 for ; Tue, 28 Sep 2004 17:08:26 +0000 (GMT) X-OB-Received: from unknown (205.158.62.178) by wfilter.us4.outblaze.com; 28 Sep 2004 17:08:15 -0000 Received: by ws1-14.us4.outblaze.com (Postfix, from userid 1001) id 200C4790055; Tue, 28 Sep 2004 17:08:15 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-Mailer: MIME-tools 5.41 (Entity 5.404) Received: from [66.57.13.107] by ws1-14.us4.outblaze.com with http for dhaigh@mail.com; Tue, 28 Sep 2004 12:08:15 -0500 From: "Doug Haigh" To: freebsd-sparc64@freebsd.org Date: Tue, 28 Sep 2004 12:08:15 -0500 X-Originating-Ip: 66.57.13.107 X-Originating-Server: ws1-14.us4.outblaze.com Message-Id: <20040928170815.200C4790055@ws1-14.us4.outblaze.com> Subject: ioctl switch statement weirdness X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2004 17:08:27 -0000 I have a standard ioctl routine that takes an u_long value as the command. As I was testing out my ioctl routine on a Sun Ultra 60 running 5.2.1 I kept getting 'invalid ioctl' statments from my routine. What I discovered was that if the value of the ioctl included the IOC_IN flag, it would not be recognized. The IOC_IN flag sets the highest order bit (0x80000000) so the only thing I could think of was that the switch statement was sign extending the IOCTL value, but the case statement was not. To see if this was the case, I assigned the u_long value (an unsigned 64 bit value) to an unsigned int value (a 32 bit value) and used that in the switch statement. It worked. So the u_long type on the ioctl parameters will not work if the high order bit is set. Is this a problem with the FreeBSD definition of the ioctl command value or gcc's problem? -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm