Date: Fri, 24 Dec 2010 18:16:44 +0330 From: Mohammad Hedayati <hedayati.mo@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: Inappropriate ioctl for device Message-ID: <AANLkTinBFh6KpZvJxAbxxFJzDFGYXB=Uofvdp2zD2s6X@mail.gmail.com> In-Reply-To: <AANLkTinC4VROgD40GM1v7Mfdzk7_rtwQOFfKaa--0gC_@mail.gmail.com> References: <AANLkTi=oUgvCMGtaayXnE%2BBW0nTbZSuuyXXkkOSg7Ccf@mail.gmail.com> <AANLkTinC4VROgD40GM1v7Mfdzk7_rtwQOFfKaa--0gC_@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 24, 2010 at 6:00 PM, C. P. Ghost <cpghost@cordula.ws> wrote: > On Fri, Dec 24, 2010 at 11:21 AM, Mohammad Hedayati > <hedayati.mo@gmail.com> wrote: > > I'm writing a simple char device. So far everything went so good > > (read/write), but here I'm going to add support for ioctl. > > > > int > > ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct > thread *td) > > { > > int error = 0; > > uprintf("Here...\n"); > > return(error); > > } > > and I'm calling it here: > > > > len = ioctl(cd, 0); > > perror("ioctl"); > > > > but when runnig it says: > > > > ioctl: Inappropriate ioctl for device > > Just a wild guess: are you sure you've hooked up your > ioctl() function to the struct cdevsw, i.e. something > like this? > > static struct cdevsw yourdevice_cdevsw = { > .d_version = D_VERSION, > .d_read = yourdevice_read, > .d_write = yourdevice_write, > .d_ioctl = yourdevice_ioctl, /* <--- or just ioctl? */ > .d_name = "yourdevice", > }; > > Perhaps you could ask on freebsd-hackers@ list instead? > > > where's the problem? > > -cpghost. > > -- > Cordula's Web. http://www.cordula.ws/ > Yes, I did. Thanks!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinBFh6KpZvJxAbxxFJzDFGYXB=Uofvdp2zD2s6X>