#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include "timer.h"
#include "dprint.h"
#include "error.h"
#include "pt.h"
#include "config.h"
#include "sr_module.h"
#include "mem/mem.h"
#include "mem/shm_mem.h"
#include <stdlib.h>

Go to the source code of this file.
Data Structures | |
| struct | sr_timer_process |
Functions | |
| int | count_timer_procs (void) |
| Counts the timer processes that needs to be created. | |
| void | destroy_timer (void) |
| Free timers. | |
| unsigned int | get_ticks (void) |
| Return the actual tick count. | |
| utime_t | get_uticks (void) |
| Return the actual utick count. | |
| int | init_timer (void) |
| Initialize the timers, allocate jiffies and ujiffies in shared memory. | |
| static struct sr_timer * | new_sr_timer (timer_function f, void *param, unsigned int interval) |
| Create a new timer, allocated in private memory. | |
| static struct sr_timer_process * | new_timer_process_list (unsigned int flags) |
| Create a new timer process list in private memory. | |
| int | register_timer (timer_function f, void *param, unsigned int interval) |
| register a periodic timer; | |
| int | register_timer_process (timer_function f, void *param, unsigned int interval, unsigned int flags) |
| register a timer process | |
| int | register_utimer (utimer_function f, void *param, unsigned int interval) |
| register a periodic utimer; | |
| static void | run_timer_process (struct sr_timer_process *tpl, int do_jiffies) |
| Run a timer process. | |
| int | start_timer_processes (void) |
| Start timer processes. | |
| static void | timer_ticker (struct sr_timer *timer_list) |
| Process all timer on the list. | |
| static void | utimer_ticker (struct sr_timer *utimer_list) |
| Process all utimer on the list. | |
Variables | |
| static unsigned int * | jiffies = 0 |
| static unsigned int | timer_id = 0 |
| static struct sr_timer_process * | timer_proc_list = 0 |
| static utime_t * | ujiffies = 0 |
Definition in file timer.c.
| int count_timer_procs | ( | void | ) |
Counts the timer processes that needs to be created.
Definition at line 415 of file timer.c.
References sr_timer_process::next, NULL, sr_timer_process::timer_list, and sr_timer_process::utimer_list.
Referenced by init_multi_proc_support().
| void destroy_timer | ( | void | ) |
| unsigned int get_ticks | ( | void | ) |
Return the actual tick count.
Definition at line 235 of file timer.c.
References jiffies, and LM_CRIT.
Referenced by add_list_to_head(), build_sipping(), clean_routine(), dialog_update_db(), get_time_ser(), insert(), insert_dlg_timer(), load_dialog_info_from_db(), pike_check_req(), remove_timeout(), reserve_nonce_index(), rtpp_test(), schedule_to_kill(), select_rtpp_node(), send_rtpp_command(), set_1timer(), set_gettime_function(), set_timer(), sl_filter_ACK(), sl_send_reply_helper(), sl_startup(), tls_tcpconn_init(), update_dialog_dbinfo(), update_dlg_timer(), xj_jcon_pool_add_jmsg(), xj_jcon_set_attrs(), xj_jcon_update(), xj_worker_check_qmsg(), and xj_worker_process().
| utime_t get_uticks | ( | void | ) |
Return the actual utick count.
Definition at line 248 of file timer.c.
References LM_CRIT, and ujiffies.
Referenced by set_1timer(), and set_timer().
| int init_timer | ( | void | ) |
Initialize the timers, allocate jiffies and ujiffies in shared memory.
Definition at line 99 of file timer.c.
References E_CFG, E_OUT_OF_MEM, jiffies, LM_CRIT, LM_ERR, new_timer_process_list(), NULL, shm_malloc(), TIMER_PROC_INIT_FLAG, TIMER_TICK, ujiffies, and UTIMER_TICK.
Referenced by main().
| static struct sr_timer* new_sr_timer | ( | timer_function | f, | |
| void * | param, | |||
| unsigned int | interval | |||
| ) | [static, read] |
Create a new timer, allocated in private memory.
Definition at line 148 of file timer.c.
References sr_timer::expires, sr_timer::id, sr_timer::interval, jiffies, LM_ERR, NULL, pkg_malloc, sr_timer::t_param, sr_timer::timer_f, timer_id, and sr_timer::u.
Referenced by register_timer(), register_timer_process(), and register_utimer().
| static struct sr_timer_process* new_timer_process_list | ( | unsigned int | flags | ) | [static, read] |
Create a new timer process list in private memory.
Definition at line 71 of file timer.c.
References sr_timer_process::flags, LM_ERR, sr_timer_process::next, NULL, and pkg_malloc.
Referenced by init_timer(), and register_timer_process().
| int register_timer | ( | timer_function | f, | |
| void * | param, | |||
| unsigned int | interval | |||
| ) |
register a periodic timer;
Definition at line 173 of file timer.c.
References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), sr_timer::next, NULL, and sr_timer_process::timer_list.
Referenced by init_black_lists(), init_dlg_db(), initialize_kill(), mod_init(), and pike_init().
| int register_timer_process | ( | timer_function | f, | |
| void * | param, | |||
| unsigned int | interval, | |||
| unsigned int | flags | |||
| ) |
register a timer process
Definition at line 211 of file timer.c.
References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), new_timer_process_list(), sr_timer::next, NULL, and sr_timer_process::timer_list.
Referenced by mod_init().
| int register_utimer | ( | utimer_function | f, | |
| void * | param, | |||
| unsigned int | interval | |||
| ) |
register a periodic utimer;
Definition at line 193 of file timer.c.
References E_OUT_OF_MEM, sr_timer::id, new_sr_timer(), sr_timer::next, NULL, and sr_timer_process::utimer_list.
Referenced by mod_init().
| static void run_timer_process | ( | struct sr_timer_process * | tpl, | |
| int | do_jiffies | |||
| ) | [static] |
Run a timer process.
Definition at line 311 of file timer.c.
References jiffies, LM_DBG, NULL, sr_timer_process::timer_list, TIMER_TICK, timer_ticker(), ujiffies, sr_timer_process::utimer_list, UTIMER_TICK, and utimer_ticker().
Referenced by start_timer_processes().
| int start_timer_processes | ( | void | ) |
Start timer processes.
Definition at line 380 of file timer.c.
References sr_timer_process::flags, init_child(), internal_fork(), LM_CRIT, LM_ERR, sr_timer_process::next, NULL, pid, PROC_TIMER, run_timer_process(), sr_timer_process::timer_list, TIMER_PROC_INIT_FLAG, and sr_timer_process::utimer_list.
Referenced by main_loop().
| static void timer_ticker | ( | struct sr_timer * | timer_list | ) | [inline, static] |
Process all timer on the list.
Definition at line 261 of file timer.c.
References sr_timer::expires, sr_timer::interval, jiffies, sr_timer::next, sr_timer::t_param, sr_timer::timer_f, TIMER_TICK, and sr_timer::u.
Referenced by run_timer_process().
| static void utimer_ticker | ( | struct sr_timer * | utimer_list | ) | [inline, static] |
Process all utimer on the list.
Definition at line 291 of file timer.c.
References sr_timer::expires, sr_timer::interval, sr_timer::next, sr_timer::t_param, sr_timer::u, ujiffies, sr_timer::utimer_f, and UTIMER_TICK.
Referenced by run_timer_process().
unsigned int* jiffies = 0 [static] |
Definition at line 63 of file timer.c.
Referenced by destroy_timer(), get_ticks(), init_timer(), new_sr_timer(), run_timer_process(), and timer_ticker().
unsigned int timer_id = 0 [static] |
struct sr_timer_process* timer_proc_list = 0 [static] |
Definition at line 64 of file timer.c.
Referenced by destroy_timer(), get_uticks(), init_timer(), run_timer_process(), and utimer_ticker().
1.5.6