This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Variable size Message boxes
Bart Veer wrote:
>
> >>>>> "Rajendran," == Rajendran, Balakumaran (CTS) <RBalakum@chn.cts-corp.com> writes:
>
> Rajendran> I need to create message boxes of variable sizes for my
> Rajendran> application. In ECOS, the size of the message box can
> Rajendran> be configured by the
> Rajendran> CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE parameter. But all
> Rajendran> the message boxes created will be of the same size. Is
> Rajendran> there a way by which variable size message boxes can be
> Rajendran> created and used?
>
> Not with the message boxes provided by the kernel.
>
> It is not clear whether you want message boxes which can change size
> dynamically, or if you want message boxes of different but fixed sizes.
It the latter you can use POSIX message queues from <mqueue.h> from the
EL/IX code in CVS. Or even use the Cyg_MQueue type which is part of the
kernel, in <cyg/kernel/mqueue.hxx>, but which is not part of the *exported*
API because it is solely present to support POSIX message queues. This
means C++ for a start, and the documentation for that API is whatever is in
mqueue.hxx :-). It's a private internal API.
> The former would require some form of dynamic memory allocation, i.e.
> if you post to a full message box then the kernel would need to extend
> the message box.
There's a simpler way to do it. Just make the kernel message boxes take
void *'s, and then it is up to the *application* to malloc stuff, and then
when it is received, free it. That is the intended use of the kernel
message boxes to make the implementation simplest and fastest.
Jifl
--
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault