
mmap returns invalid address
Hi,
I try to use mmap to access a /dev/video device via
memorymap = (unsigned char*)mmap(0, mbuf.size, PROT_READ, MAP_SHARED,
device, 0);
The de{*filter*} tells me now, that the address I got is out of bounds.
memorymap is not equal to MAP_FAILED (in fact it is 0x40def000).
The memorymap pointer is a member of a cpp-Class representing the
video-device and the above instruction is in a method of this class.
The size and device parameters are valid.
the source of the method is:
int CCamera::initMemoryMap()
{
if(ioctl(device, VIDIOCGMBUF, &mbuf) == -1)
{
DBGOUT("error at VIDIOCGMBUF");
}
memorymap = (unsigned char*)mmap(0, mbuf.size, PROT_READ,
MAP_SHARED, device, 0);
if(memorymap == MAP_FAILED)
{
DBGOUT("mmap error");
}
else
{
DBGOUT("mmap size: %d\n", mbuf.size);
}
return 0;
Quote:
}
thanks in advance,
Klaus