Date: Wed, 29 Jul 2015 16:25:22 -0700 From: John-Mark Gurney <jmg@funkthat.com> To: Laurie Jennings <laurie_jennings_1977@yahoo.com> Cc: John Baldwin <jhb@freebsd.org>, freebsd-net@freebsd.org Subject: Re: Locking Memory Question Message-ID: <20150729232522.GN78154@funkthat.com> In-Reply-To: <1438208806.66724.YahooMailBasic@web141505.mail.bf1.yahoo.com> References: <201310151521.25231.jhb@freebsd.org> <1438208806.66724.YahooMailBasic@web141505.mail.bf1.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Laurie Jennings via freebsd-net wrote this message on Wed, Jul 29, 2015 at 15:26 -0700: > > I have a problem and I can't quite figure out where to look. This is what Im doing: > > I have an IOCTL to read a block of data, but the data is too large to return via ioctl. So to get the data, > I allocate a block in a kernel module: > > foo = malloc(1024000,M_DEVBUF,M_WAITOK); > > I pass up a pointer and in user space map it using /dev/kmem: An easier solution would be for your ioctl to pass in a userland pointer and then use copyout(9) to push the data to userland... This means the userland process doesn't have to have /dev/kmem access... Is there a reason you need to use kmem? The only reason you list above is that it's too large via ioctl, but a copyout is fine, and would handle all page faults for you.. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150729232522.GN78154>