Subject: Re: kernfs and mmap
To: None <>
From: Manuel Bouyer <>
List: tech-kern
Date: 05/07/2006 00:47:30
On Fri, May 05, 2006 at 11:59:54PM +0200, Manuel Bouyer wrote:
> Hi,
> for Xen-3 I need to support mmap on a kernfs file. I see there was some
> code in kernfs but it was removed, it was probably incomplete. However,
> it looks like it can call a per-entry mmap function and it's exactly
> what I need. EOPNOTSUP is will be returned for entries that don't support
> mmap.
> Now, the problem is what do I have to do in my entry-specific funtion.
> I have a struct vop_mmap_args*, and I need to map in the process VM space
> a page which is already mapped in kernel space (yes, it will be shared
> memory, and the space to be mapped is only one page long). How can I do this ?
> Is there some code doing this already in the tree ?
> Note that this file in /kern appears as a regular file, and I'd prefer to
> keep it this way (not turn it into a character device)

Reading more code, it seems that this is not possible without changing a lot
of MI code (the vnode mmap interface is just not designed for that) so I'll
go with a character device.

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference