how to use the function copyout()

Stefan Sperling stsp at
Mon Jul 25 12:53:31 GMT 2005

On Mon, Jul 25, 2005 at 04:35:20PM +0400, Felix-KM wrote:
> I can't understand how to use the function copyout().
> It is necessary to write the data from a device driver to the
> array defined in user program.
> I do it this way:
> #define IOCTL_GET_B    _IOWR("F", 127, 0x4)


> Here I get EFAULT.
> What have I done wrong? How can I do it correctly?

You may need to add your ioctl to another middle layer.

For example, to add ioctls to network devices, I first added
defines to sockio.h only, and it wouldn't work ("device not
configured"). Then I found out that I had to add my ioctls
to a rather large switch statement in if.c too.

hope this helps,
stefan                                 PGP Key: 0xF59D25F0

More information about the freebsd-hackers mailing list