Subject RE: [IB-Architect] Re: Events Improvement
Author Dmitry Yemanov
Jim and others,

The v1 deadline is coming, so let's go back to our discussion. As I
mentioned before, my proposal is an additional API routine that will be
responsible for decoding the extended EPB and returning the detailed event
information to the client. It could be, for example:

typedef struct {
short event_count;
char event_name[1]; // either C-style string with '\0' at the end or
this field should be replaced by the couple: (length, name)

ISC_STATUS isc_event_details( // maybe could be <void> as well
short event_buffer_length, // in
char* event_buffer, // in
char* event_name, // in
short *detailed_buffer_length, // out
ISC_EVENT_DETAILS *detailed_buffer // out

I can see four possible solutions:

1. The format of the detailed part of the EPB is changed to be binary
compatible (fully or partially) with ISC_EVENT_DETAILS, thus the API routine
can just return a pointer to the particular part of EPB. In this case we
don't worry about the memory allocation, because it's not neccessary at all.
All appropriate event work will belong to the AST.
2. The API routine allocates the requested detailed blocks and return the
pointer to the caller. But who will release this [possibly huge amount of]
3. The AST asks about the memory needed and allocates it, then passes the
allocated buffer to the API routine. After all work is done, the AST frees
this memory.
4. The client allocates some amount of memory somewhere before the AST is
called and prays for the size of this buffer to be enough. As for me, it
seems totally dumb.

The second and third solutions require the problem of the memory allocation
in classic signal handlers to be somehow resolved. Maybe we could discuss
some easy ways to follow until (or instead of) an elegant and universal
solution is found. I would like to know whether one of the following things
could be considered as a permanent or temporary solution to this problem:

a) we keep it as is and leave this trouble up to clients
b) we limit the wildcarding to the multithreaded platforms only
c) we implement all event delivery stuff via threads (just change #ifdef)
and thus limit the complete event existence to the multithreaded platforms

Any thoughts?