tech-userlevel archive

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

Re: Cannot mmap character device



manu%netbsd.org@localhost (Emmanuel Dreyfus) writes:

>Hello

>the mmap(2) page explicitely notes that we may map character devices.
>Anyone can tell me why this fails?

We may map character devices, but not all of them.

Basically:

if (vp->v_type != VCHR) {
	/* == VBLK */
	error = VOP_MMAP(vp,...);
} else {
	uobj = udv_attach(vp->v_rdev,...);
	if (uobj == NULL)
		error = EINVAL;
}

VOP_MMAP is handled by specfs which builds the mmap function on
top of the buffer cache.

udv_attach calls the driver mmap entry point and the disk drivers 
use the dummy function 'nommap' that just fails.

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index