Fear and loathing in ipcname_gettotal.
John Hughes <[email protected]> Wed, 25 Mar 2009 14:28:13 +0100
| Newsgroups | gmane.linux.cluster.ssic.devel |
|---|---|
| Message-ID | <[email protected]> |
Ok, here's a problem.
We want to get the table mapping IPC keys to nodes from an ipc
nameserver, so we use the cli_ipcname_gettotal function. When
cli_ipcname_gettotal is called with a "size" of -1 it is supposed to
return the size of the table, otherwise it returns the table.
The problem is, who is supposed to allocate the array for the return
value when size is not -1? When cli_ipcname_gettotal is called on the
nameserver node it just calls ipcname_gettotal directly, which allocates
the space itself. When it is called on another node it calls
RIPC_IPCNAME_GETTOTAL which expects that the caller will allocate the space.
RIPC_IPCNAME_GETTOTAL calls cli_ripc_ipcname_gettotal
which calls cli_decode_gen_var_ool_char_p_p
which calls icscli_decode_ool_data_t
which calls icscli_lldecode_ool_data_t:
/*
* icscli_lldecode_ool_data_t()
* Extract an OOL output parameter into the specified area
*
* Description:
* Extract an OOL output parameter for the specified handle into
* the user-provided buffer area. Called by ICS high-level code
* to perform argument marshalling for client/server interaction.
*
So, in the local case memory is allocated by cli_ipcname_gettotal, and
in the non-local case memory must be allocated by the caller.
Ugh.
Is this true? The operation is declared as:
operation ripc_ipcname_gettotal {
param IN int service
param IN ssi_procstate_t *pstate
param OUT:OOL:VAR char **node_id_pairs
param INOUT int *sz
}
node_id_pairs is an output parameter. Who is supposed to allocate?
Also, when ipcname_gettotal is called on the server side, from
ripc_ipcname_gettotal, who is supposed to free the allocated list?
svr_ripc_ipcname_gettotal calls ripc_ipcname_gettotal
which calls ipcname_gettotal.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com