Re: Having problem with mmap system call!!!

From: Alan Cox
Date: Thu Sep 16 2004 - 09:48:56 EST


On Iau, 2004-09-16 at 15:07, Richard B. Johnson wrote:
> if((vp = mmap((caddr_t) HINT, len, PROT, FLAGS, fd, addr)) == SHM_FAIL)
> {
> fprintf(stderr, "Can't access shared memory\n");
> exit(EXIT_FAILURE);

SHM_FAIL is the wrong error check btw.

It is much better to do this in the driver than do nasty user mode hacks
using /dev/mem. When you do it kernel driver side you end up with a
cleaner mmap interface, a sensible permissions model and the hardware
device pages mapped directly and nicely into the app

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/