CE5: Accessing shared memory from a 2nd process



Hello gurus,

I want to be able to access a buffer allocated in shared memory from 2 or +
APIs. The reason is quite simple, the sell department wants to be able to
sell the module (APIs) separately.

So I have a peripheral's driver that will write into a buffer allocated by
the first calling API but can be used by the others APIs. I have no problem
concerning the multiple access aspect. The problem I have is when I am
trying to read the buffer from the 2nd API the buffer has no data in it.

What I have done is that my driver has a copy of the buffer pointer that is
updated when the 1st API is allocating the shared memory. The buffer size
is ~2.5 MB. Later, the 2nd API will ask the driver if a buffer is already
allocated, if so the driver will give the copy of the pointer. Now, what I
am expecting is either one of the APIs could ask for a transfer to the
buffer to the driver and the data will be updated in the shared buffer and
accessible by both API's pointer. Unfortunately, it doesn't work so I am
missing a piece.

I am stocking the pointer value in the driver with the following variable.
static unsigned char *pSharedBuffer; // Global scope

The buffer is allocated in the api with the following lines.

unsigned char *ImageBuffer; //API Global Scope
ImageBuffer = VituralAlloc(0, 2621440, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc(ImageBuffer, 2621440, MEM_COMMIT, PAGE_READWRITE);

I am passing back the value of ImageBuffer to the driver so it can hold it
in pSharedBuffer for the other APIs.
Otherwise, the pointer value from the driver is copy in ImageBuffer.

I checked the value of the pointer and it is 0x00060000 everywhere. Why the
API that is not allocating the buffer cannot read it?

Regards,
Keaven




.



Relevant Pages

  • Re: [Alsa-devel] Re: [PATCH 2.6.13.1 1/1] CS5535 AUDIO ALSA driver
    ... I thought of creating an API for coherent SG-buffers, ... The question is whether mmap of non-coherent buffer may ...
    (Linux-Kernel)
  • Re: How to develop a random number generation device
    ... Many operating systens are by design, immune to buffer over-runs modifying unrelated code. ... randomising memory locations) rather than actually preventing the overrun. ... If you try to run a 5-year old Linux binary on a current distribution, ... Linux, and the API is very stable - new API's and system calls are added, but existing ones are seldom changed or removed, and never without very good reason. ...
    (sci.electronics.design)
  • [rfc][patch] fix buffered write deadlocks with extra copy (and a way out?)
    ... API fell on its face because it ended up breaking filesystems and the ... buffer, then a second from temp buffer to actual pagecache. ... I would like more input about this from filesystems people, ...
    (Linux-Kernel)
  • Re: Socket API performance diff. between Sp2k2 and 2k3
    ... Do you mean the TCP buffer? ... package size and then the whole package size 7 kB when it is file data. ... API on the Sp2002. ... >> Socket API and WinInet API? ...
    (microsoft.public.pocketpc.developer.networking)
  • Re: get_user_pages fails for contiguous memory?
    ... I trying run/test a simple use case where, I am allocating buffers in one driver using get_free_pages, map them to user application and pass it to another driver for processing. ... I would like to use this buffer in resizer driver, which resizes the image depending on user configuration. ... If I allocate a memory using malloc or memalign from in user space and pass it to resizer driver it works fine. ...
    (Linux-Kernel)