From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,47c3c23c50f4dcda X-Google-Attributes: gidfee84,public X-Google-Thread: 1164f8,47c3c23c50f4dcda X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-11-13 17:35:16 PST Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!news.iastate.edu!john From: john@iastate.edu (John Hascall) Newsgroups: comp.sys.dec,comp.unix.osf.osf1 Subject: Re: Strange error in STREAMS code Date: 13 Nov 1994 23:48:52 GMT Organization: Iowa State University, Ames, Iowa (USA) Message-ID: <3a68l4$nf0@news.iastate.edu> References: <3a5nmv$4n4@hermes.unt.edu> <3a6785$agm@hermes.unt.edu> NNTP-Posting-Host: pooh.cc.iastate.edu Xref: nntp.gmd.de comp.sys.dec:19647 comp.unix.osf.osf1:6467 Steve Tate wrote: }Here's the poop: The variable i->ioc_cmd is of type int, so gets }loaded into a 64-bit register with sign extension. The highest bit }is set in my example, so the high longword gets filled with ones. All }of the ioctl codes defined with _IOW(..) are of the form }(0x80000000 | .. | sizeof(.)), and the sizeof() operator makes this }whole constant expression actually to be of type long (maybe unsigned }long, I'm not sure.... but it is an 8 byte data type). Thus when }this value is used in a 64-bit register, it is NOT sign extended, }and the high longword is zero. Thus the equality test will always }be false. >From "man ioctl": #include ioctl( int d, unsigned long request, <--- looks like it is intentional char *argp ); that they are 64 bits. I guess you should declare i->ioc_cmd as "unsigned long" too. John -- John Hascall ``An ill-chosen word is the fool's messenger.'' Systems Software Engineer, ISU Comp Center + Ames, IA 50011 + 515/294-9551 & Hascall Systems - Unix/C/Internet Consulting, Training, Custom Programming