Date: Sun, 7 Sep 1997 11:04:11 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: freebsd-hackers@FreeBSD.ORG Subject: Re: IOCTL Commands - Where is my mistake? Message-ID: <19970907110411.XU48502@uriah.heep.sax.de> In-Reply-To: <199709030821.RAA00286@word.smith.net.au>; from Mike Smith on Sep 3, 1997 17:51:57 %2B0930 References: <XFMail.970903004053.Shimon@i-Connect.Net> <199709030821.RAA00286@word.smith.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
As Mike Smith wrote: > > I want to pass IOCTL commands to a driver. This is what I do: > > > > #define DPT_IOCTL_INTERNAL_METRICS _IOW('D', 1, dpt_perf_t) > > You want to pass a pointer to the struct, not the struct itself. He does. The last argument of the _IOR, _IOW, and _IOWR macros always translates into ``pointer to the given type''. Passing an `int' directly (as SysV does) is not directly supported in FreeBSD, but can be emulated using the _IO macro. (The SysV compat syscalls in the console drivers do need this feature.) > caddr_t dest; > > /* get address in userspace */ > dest = fuword(*(caddr_t *)cmdarg); > /* copy out to userspace */ > return(copyout(&dpt->performance, dest, > sizeof(dpt->performance)) In Simon's case, the copyin/copyout would be handled by the upper ioctl() layers already (unlike SysV). I don't see why he should not use this feature. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970907110411.XU48502>