[Serusers] RE: SER and child_init()

'Jan Janak ' jan at iptel.org
Thu Nov 4 12:40:06 CET 2004


Just to add to this -- all "service" processes like the timer process,
tcp_main process, fifo server and so on, have the rank number negative.
The initial (main) process has the number set to 0 and all receivers
have positive rank values.

  Jan.

On 04-11 09:21, Bogdan-Andrei IANCU wrote:
> init_child functions takes as parameter the rank of the process - that's 
> exactly you are looking for.
> 
> bogdan
> 
> 
> Gandhi, Jignesh wrote:
> >Thanks for the quick reply.
> >
> >I looked at the sr_module.h and saw the defs that you are talking about.
> >Now I am starting SER with fork=yes and children=2. 
> >so I get the following output from serctl ps cmd.
> >[root at test gl]# serctl ps
> >0       10771   attendant
> >1       10773   receiver child=0 sock=0 @ 192.168.160.12:5060
> >2       10774   receiver child=1 sock=0 @ 192.168.160.12:5060
> >3       10775   fifo server
> >4       10776   timer
> >5       10777   tcp receiver
> >6       10778   tcp receiver
> >7       10779   tcp main process
> >
> >The only rank values that I can count on not to startup a socket connection
> >in the child_init function are -1, -2, -4. 
> >The question I have is, how can I know in my child_init function that the
> >process that the child_init() function is called from is 
> >"receiver child=n" ? 
> >for example I know that if I have set children=2 in ser.cfg than the first 
> >2
> >times the child_init function will be called from the receiver child=0 and
> >receiver child=1 thread. Also How come the tcp receiver is getting started
> >for each child ?
> >
> >
> >I hope that I am making sense here.
> >
> >thanks,
> >Jignesh Gandhi
> >
> >-----Original Message
> >From: Jan Janak
> >To: Gandhi, Jignesh
> >Cc: 'serusers at lists.iptel.org'
> >Sent: 11/3/2004 11:08 AM
> >Subject: Re: [Serusers] RE: SER in debug mode
> >
> >no fork mode means that there will be only one process listening for and
> >processing SIP messages. In addition to that there will be also the
> >timer process (taking care of timers) and fifo process (processing
> >commands sent to ser over the FIFO interface). The child init function
> >will be called for all of them. See:
> >
> >root at localhost:/home/janakj# serctl ps
> >0       6266    stand-alone receiver @ 127.0.0.1:5060
> >1       6267    timer
> >2       6268    fifo server
> >
> >If you want to execute the code in the listening process only, then you
> >can ignore calls of child_init that have the parameter set to PROC_TIMER
> >and PROC_FIFO (defined in sr_module.h).
> >
> >Note that it is usually a good idea to have the same environment in the
> >timer process as in the receiver as some functionality might be called
> >from the timer.
> >
> >  Jan.
> >
> >On 03-11 10:14, Gandhi, Jignesh wrote:
> >
> >>Hello all,
> >>
> >>I am trying to debug a new module that I have written.
> >>So I have set fork=no and debug=4 and commented out the
> >>child line. 
> >>
> >>The question I have is that the how may times the child_init() 
> >>function be called ?
> >>
> >>
> >>The child_init() function in my module sets up a socket connection
> >>to a server and I can see that the child_init() function is getting
> >>called 3 times. I do not understand this. Am I missing something ?
> >>
> >>The mod_init function is getting called only once, like it is supposed
> >
> >to.
> >
> >>I have attached the output from ser startup. The module that I have
> >
> >written 
> >
> >>is called gl.
> >>
> >>Nov  2 14:07:20 sara ser: INFO: glenayre redirector(gl module)
> >
> >initializing
> >
> >>Nov  2 14:07:20 sara ser: INFO: udp_init: SO_RCVBUF is initially 65535
> >>Nov  2 14:07:20 sara ser: INFO: udp_init: SO_RCVBUF is finally 262142
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): init_child #-1 /
> >
> >pid
> >
> >><10269>
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): Initializing TCP
> >>connection
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP port = 1234
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP host =
> >
> >localhost
> >
> >>Nov  2 14:07:20 sara ser: INFO: fifo process starting: 10270
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): init_child #-2 /
> >
> >pid
> >
> >><10270>
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): Initializing TCP
> >>connection
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP port = 1234
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP host =
> >
> >localhost
> >
> >>Nov  2 14:07:20 sara ser: SER: open_uac_fifo: fifo server up at
> >>/tmp/ser_fifo...
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): init_child #1 /
> >
> >pid
> >
> >><10268>
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): Initializing TCP
> >>connection
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP port = 1234
> >>Nov  2 14:07:20 sara ser: gl:INFO: gl_child_init(): TCP host =
> >
> >localhost
> >
> >>any help is appreciated,
> >>
> >>thanks,
> >>Jignesh Gandhi
> >>Software Engineer II
> >>Jignesh.Gandhi at glenayre.com
> >>
> >>
> >>
> >>_______________________________________________
> >>Serusers mailing list
> >>serusers at lists.iptel.org
> >>http://lists.iptel.org/mailman/listinfo/serusers
> >
> >
> >_______________________________________________
> >Serusers mailing list
> >serusers at lists.iptel.org
> >http://lists.iptel.org/mailman/listinfo/serusers
> 




More information about the sr-users mailing list