[Devel] rank == PROC_FIFO

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Oct 17 18:38:12 CEST 2006


Hi Juha,

Juha Heinanen wrote:

>Bogdan-Andrei Iancu writes:
>
> > I did the changes - each module exports an extra structure describing 
> > the functions to be registered for MI; for each function you can set an 
> > init function - this should solve the problem.
> > 
> > I did the modifications for LCR and DOMAIN module - please test them and 
> > let me know if it works properly.
>
>bogdan,
>
>while implementing mi interface for permissions module i was reading
>your domain module mi code and have a question.  in mi_exports
>
>static mi_export_t mi_cmds[] = {
>	{ MI_DOMAIN_RELOAD,   mi_domain_reload,   0,  mi_child_init },
>	{ MI_DOMAIN_DUMP,     mi_domain_dump,     0,  0 },
>	{ 0, 0, 0, 0}
>};
>
>when is mi_child_init called?  
>  
>
this init functions are only called by the processes running the mi 
commands (for example by the processed spawned by mi_fifo module for 
listening on the fifo file).

>what if there is two reload functions like in permissions module:
>
>static mi_export_t mi_cmds[] = {
>	{ MI_DOMAIN_RELOAD,   mi_domain_reload,   0,  mi_child_init },
>	{ MI_DOMAIN_DUMP,     mi_domain_dump,     0,  0 },
>	{ MI_ADDRESS_RELOAD,  mi_address_reload,  0,  mi_child_init },
>	{ MI_ADDRESS_DUMP,    mi_address_dump,    0,  0 },
>	{ 0, 0, 0, 0}
>};
>
>mi_child_init that initializes db, should be called only once, not
>twice.
>  
>
correct - in this case you have two functions that needs the same 
resource, so it can be init by only one of the functions (the same in 
cpl-c module where there is a DB link shared by 3 mi functions)

>why is mi_child_init associated with individual mi commands and not with
>mi process?
>  
>
the mi_child_init are used only by mi processes. I chose to have a init 
function per mi function to have more liberty - maybe you different 
resources required by different mi functions (like DB links, file 
descriptors, etc)

>looks like i don't understand how this is supposed to work.
>  
>

it is similar to the init_child() which should be called only from the 
worker processes. mi_init_child() functions are called in each mi 
process. I chose to have a init per function and not per module not to 
complicate the export structure and also to give more liberty.

if I can help you with more information, please let me know.

Regards,
Bogdan




More information about the Devel mailing list