mmap returns invalid address 
Author Message
 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



Mon, 25 Apr 2005 19:58:44 GMT  
 mmap returns invalid address

Quote:
> 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()
> {

First, C and C++ are two different languages, so if you want C++
you should go to comp.lang.c++. But you don't want that either,
because mmap is neither a standar C nor a standard C++ function
and questions about it should be taken to a newsgroup related to
the system providing it.
--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond


Mon, 25 Apr 2005 20:04:33 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Incomplete import address table causes jump to invalid address

2. Incomplete import address table causes jump to invalid address

3. return an address VS return structure

4. invalid address alignment

5. signal BUS (invalid address alignment) !!!!!!

6. Invalid pointer addresses

7. "Invalid Address specified to RtlFreeHeap(..)"

8. Invalid Address - RtlSizeHeap caused by function

9. Invalid Address specified to RtlValidateHeap in EXE Server

10. Invalid Address specified to RtlFreeHeap (Debug in Win2000 Proffesional+SP3)

11. Invalid Address - RtlSizeHeap caused by function

12. HEAP Invalid Address

 

 
Powered by phpBB® Forum Software