Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2004 12:08:15 -0500
From:      "Doug Haigh" <dhaigh@mail.com>
To:        freebsd-sparc64@freebsd.org
Subject:   ioctl switch statement weirdness
Message-ID:  <20040928170815.200C4790055@ws1-14.us4.outblaze.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040928170815.200C4790055>