mmap() on pseudo device

Daniel O'Connor doconnor at gsoft.com.au
Tue Jan 20 17:51:13 PST 2004


On Tuesday 20 January 2004 09:08, Anand Subramanian wrote:
> 1. I'm creating a pseudo device and having a user space process mmap() the
> device memory into its address space. So the mmap for the device has to be
> implemented. Are there any useful driver/source files I could look at for
> this?
>
> 2. How can I access the mmaped memory from another kernel loadable module?

The bktr driver is probably reasonable to look at, although it needs 
contiguous address space and I suspect you don't.

> 3. For the user space program, after it does a mmap() on the
> pseudo-device, is there any way it can force malloc() to operate on the
> mmaped memory? Or am I forced to write my own lightweight memory manager?
> Most of the memory managers around seem to be way too complicated to
> quickly fix or customize for a simple need.

Why would you want to malloc from your mmap'd region?
Once you have mmap'd it you can validly read/write (subject to memory 
protections) without having to malloc it first.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 9A8C 569F 685A D928 5140  AE4B 319B 41F4 5D17 FDD5



More information about the freebsd-hackers mailing list