Inappropriate ioctl for device
Mohammad Hedayati
hedayati.mo at gmail.com
Fri Dec 24 14:47:26 UTC 2010
On Fri, Dec 24, 2010 at 6:00 PM, C. P. Ghost <cpghost at cordula.ws> wrote:
> On Fri, Dec 24, 2010 at 11:21 AM, Mohammad Hedayati
> <hedayati.mo at 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!
More information about the freebsd-questions
mailing list