Branches
Comments
[»]
Virtual ring buffer
by Warren Dale - Nov 18th 2001 19:24:09
SMALL BUG 1
-----------
File vrb_init.c line 255:
if ( ! ( tempname = alloca( strlen( arg_name ) ) ) ) {
Surely this should be:
if ( ! ( tempname = alloca( strlen( arg_name ) + 1 ) ) ) {
SMALL BUG 2
-----------
File vrb_prefix.h line 201:
#define vrb_is_full(b) (((b)->length)==((b)->capacity))
You probably meant:
#define vrb_is_full(b) ((vrb_data_len((b)))==((b)->capacity))
CLARIFICATION
-------------
In vrb_init.c when (arg_name == NULL) you need to make two shmat() calls,
and you require that the return addresses are exactly "req_size"
bytes apart.
Why do you do you first make a mmap() call and then an mummap() call?
Does that -really- enhance your chances?
Will you necessarily get the same address as that from mmap()?
[reply]
[top]
[»]
Re: Virtual ring buffer
by Phil Howard - Dec 10th 2001 05:57:30
If the calls to shmat() are made with the address (arg 2) specified as
0, the system will find an "unmapped" region of address space. There is no
guarantee it will place the mapping of 2 such calls together, as VRB needs.
Only by specifying an exact address can this be guaranteed. And in order
to know what such addresses should be, mmap() is called initially to find
an opening in the address space of the proper size (twice the buffer
need).
The 2 bugs have now been corrected in the latest release, 0.3.0
(beta).
[reply]
[top]
|