On 05/31/2010 12:31 AM, Jan Friesse wrote:
> Steven Dake wrote:
>> On 05/28/2010 02:14 AM, Jan Friesse wrote:
>>> Angus,
>>> attached is fixed version of rb, which should do what you think current
>>> implementation is doing. Please take a time to read comments beginning
>>> with "^^^^^"
>>>
>>> But basically:
>>> - Implementation didn't support storing of data with non multiply
>>> word-size (ie. 32-bit) records (7 bytes, ...)
>>> - MMaped circular buffer needs backend in file. Take a look to coroipcc
>>> how to make it in shm, ...
>>>
>>> Regards,
>>>     Honza
>>
>>
>> The current mmap in Angus's code is correct - it creates a private
>> circular map that is replicated back to back to let the kernel memory
>> manager deal with wrapping.  (the log ring is never in shared memory).
>
> Maybe I'm not understand what are you trying to do. But my idea of ring
> is following:
>
>                / Memory map   \
>                | same as first \
>                | part           \
>    -------------------------------
>    |1          |1                |
>    -------------------------------
>   /            |
> /             |
> |              \
> Start of buffer \
>                   End of buffer
>
> So if I understand it correctly, if I will:
> - create new mapped region - circular_memory_map (&buf, 4096)
> - buf[0] = 'A';
> - buf[4096] = 'B';
> - printf ("%c %c\n", buf[0], buf[4096]);
>
> What should be result? If it is real circular buffer, it should be B B,
> but with current implementation it will be A B. So it is not circular
> buffer.
>

your correct; I was incorrect.  The only way to make a circular buffer 
is to have a shared memory file backing store.

Regards
-steve

>
>>
>> It would be interesting to allow the ring buffer to be created with a
>> backing store for the shared memory case.
>>
>> I'll have a look at the word size issue.
>

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to