Locking Memory Question

John-Mark Gurney jmg at funkthat.com
Wed Jul 29 23:25:23 UTC 2015


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."


More information about the freebsd-net mailing list