| 840 | |
| 841 | |
| 842 | static int fork_dynamic_timer_process(void *si_filter) |
| 843 | { |
| 844 | int p_id; |
| 845 | const struct internal_fork_params ifp_th = { |
| 846 | .proc_desc = "Timer handler", |
| 847 | .flags = OSS_PROC_DYNAMIC|OSS_PROC_NEEDS_SCRIPT, |
| 848 | .type = TYPE_TIMER, |
| 849 | }; |
| 850 | |
| 851 | if ((p_id=internal_fork(&ifp_th))<0){ |
| 852 | LM_CRIT("cannot fork Timer handler process\n"); |
| 853 | return -1; |
| 854 | } else if (p_id==0) { |
| 855 | /* new Timer process */ |
| 856 | /* set a more detailed description */ |
| 857 | set_proc_attrs("Timer handler"); |
| 858 | if (timer_proc_reactor_init() < 0 || |
| 859 | init_child(20000) < 0 || |
| 860 | self_update_routing_script() < 0) { |
| 861 | goto error; |
| 862 | } |
| 863 | |
| 864 | report_conditional_status( 1, 0); /*report success*/ |
| 865 | /* the child proc is done read&write) dealing with the status pipe */ |
| 866 | clean_read_pipeend(); |
| 867 | |
| 868 | /* launch the reactor */ |
| 869 | reactor_main_loop( 1/*timeout in sec*/, error , ); |
| 870 | destroy_worker_reactor(); |
| 871 | error: |
| 872 | report_failure_status(); |
| 873 | LM_ERR("Initializing new process failed, exiting with error \n"); |
| 874 | pt[process_no].flags |= OSS_PROC_SELFEXIT; |
| 875 | exit( -1); |
| 876 | } else { |
| 877 | /*parent/main*/ |
| 878 | return p_id; |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | |
| 883 | static void timer_process_graceful_terminate(int sender, void *param) |
nothing calls this directly
no test coverage detected