tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Cannot mmap character device



On Thu, Aug 13, 2015 at 08:18:16AM -0400, Mouse wrote:
> > the mmap(2) page explicitely notes that we may map character devices.
> > Anyone can tell me why this fails?
> 
> > [...attempt to map /dev/rxbd1a PROT_READ size 4096 offset 8192...]
> 
> You may map character devices in general, but the driver still has to
> support the particular request you make.  Offhand, I'd guess that the
> driver refused your attempt.
> 
> You don't specify what NetBSD rev you tried this on, but I looked at
> 4.0.1 (what was at ready hand) and the only xbd driver I found there,
> arch/xen/xen/xbd.c, specifies nommap as its mmap function.  If that's
> the xbd you're using and it's still so in the version you're using,
> this is operating exactly as designed.
> 
> What kind of character device is more likely to provide a non-dummy
> mmap function?  Audio and framebuffers are the ones I'm most aware of,
> but I'm sure there are plenty of others.
> 
> Why doesn't xbd provide mmap support?  My guess would be it's just a
> case of "nobody's needed it enough to bother writing it yet".

It ought to happen a layer up, like it does for disk block devices.
There is nothing special about any particular disk device that would
suggest to me it ought to need its own mmap support -- with the possible
exception of mapped, memory-backed devices that could drop the pretense that
they were "disks" in this case, likely with great complexity involved
in so doing.

Thor


Home | Main Index | Thread Index | Old Index