Date: Tue, 05 Sep 2006 16:46:45 -0700 From: Kristis Makris <kristis.makris@asu.edu> To: freebsd-drivers@freebsd.org Subject: ioctl: uiomove, copyin, copyout Message-ID: <1157500005.3414.92.camel@syd.mkgnu.net>
next in thread | raw e-mail | index | archive | help
Hello, I'm trying to port a driver from Linux 2.2-2.6 to FreeBSD. I have two problems: 1) Finding the equivalent of the Linux copy_to_user and copy_from_user routines. Are those copyin, and copyout ? 2) Getting the ioctl operation to work. When issuing an ioctl from userspace I get: # dynamos_control -o 9 ioctl error for command 9: Inappropriate ioctl for device errno is 25 it's an ENOTTY ... while in the driver I have: static d_read_t dynreplace_file_operations_read; static d_ioctl_t dynreplace_file_operations_ioctl; static struct cdevsw dynreplace_cdevsw = { .d_version = D_VERSION, .d_open = dynreplace_file_operations_open, .d_close = dynreplace_file_operations_release, .d_read = dynreplace_file_operations_read, .d_ioctl = dynreplace_file_operations_ioctl, .d_name = MODULE_NAME_STR, }; int dynreplace_file_operations_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { print( "ioctl - MAIN\n"); return 0; } ... the _read operation works as expected, but I don't even see the print statement from _ioctl. The ioctl(2) manpage reads: [ENOTTY] The d argument is not associated with a character special device. This can't be true since the read operation works, and: # ls -lrta /dev/dynamos crwx------ 1 root wheel 0, 95 Sep 2 16:31 /dev/dynamos and... [ENOTTY] The specified request does not apply to the kind of object that the descriptor d references. Is this last part somehow enforced by the kernel ? I know I have an uncommon build process, since the driver is built for multiple OSs, but if I can get the read operation to work why would ioctl be so difficult ? Am I missing something ?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1157500005.3414.92.camel>