Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Dec 2010 17:01:44 +0100
From:      Gary Jennejohn <gljennjohn@googlemail.com>
To:        Mohammad Hedayati <hedayati.mo@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Inappropriate ioctl for device
Message-ID:  <20101224170144.1d734e3c@ernst.jennejohn.org>
In-Reply-To: <AANLkTimuz3KWG80yXR8gmg%2BYxVKW0pQyF2wtfwXqKU3K@mail.gmail.com>
References:  <AANLkTimuz3KWG80yXR8gmg%2BYxVKW0pQyF2wtfwXqKU3K@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 24 Dec 2010 18:17:18 +0330
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

Carefully read ioctl(2) and consider that you're passing in 0 as the cmd.
If you still don't understand your error, post again.

Hint: look at /sys/kern/sys_generic.c:^ioctl

-- 
Gary Jennejohn



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