diff --git a/ser_time.h b/ser_time.h index e4a00000dd0..538e5afd37c 100644 --- a/ser_time.h +++ b/ser_time.h @@ -1,4 +1,4 @@ -/* +/* * time related functions * * Copyright (C) 2006 iptelorg GmbH diff --git a/timer.c b/timer.c index d5e9e720bf1..111c63f2f11 100644 --- a/timer.c +++ b/timer.c @@ -13,8 +13,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -62,8 +62,8 @@ static ticks_t* ticks=0; static ticks_t last_ticks; /* last time we adjusted the time */ static ticks_t last_adj_check; /* last time we ran adjust_ticks */ static ticks_t prev_ticks; /* last time we ran the timer, also used as - "current" ticks when running the timer for - "skipped" ticks */ + * "current" ticks when running the timer for + * "skipped" ticks */ static struct timeval last_time; static struct timeval start_time; /* for debugging */ @@ -100,11 +100,11 @@ static int in_timer=0; static gen_lock_t* slow_timer_lock; /* slow timer lock */ -static struct timer_head* slow_timer_lists; +static struct timer_head* slow_timer_lists; static volatile unsigned short* t_idx; /* "main" timer index in slow_lists[] */ static volatile unsigned short* s_idx; /* "slow" timer index in slow_lists[] */ static struct timer_ln* volatile* running_timer2=0; /* timer handler running - in the "slow" timer */ + * in the "slow" timer */ static sigset_t slow_timer_sset; pid_t slow_timer_pid; static int in_slow_timer=0; @@ -137,10 +137,10 @@ void sig_timer(int signo) void destroy_timer() { struct itimerval it; - + /* disable timer */ memset(&it, 0, sizeof(it)); - setitimer(ITIMER_REAL, &it, 0); + setitimer(ITIMER_REAL, &it, 0); set_sig_h(SIGALRM, SIG_IGN); if (timer_lock){ lock_destroy(timer_lock); @@ -199,9 +199,9 @@ int init_timer() { int r; int ret; - + ret=-1; - + /* init the locks */ timer_lock=lock_alloc(); if (timer_lock==0){ @@ -253,7 +253,7 @@ int init_timer() } last_time=start_time; LM_DBG("starting with *ticks=%u\n", (unsigned) *ticks); - + /* init timer structures */ for (r=0; rh0[r]); @@ -262,9 +262,9 @@ int init_timer() for (r=0; rh2[r]); _timer_init_list(&timer_lst->expired); - + #ifdef USE_SLOW_TIMER - + /* init the locks */ slow_timer_lock=lock_alloc(); if (slow_timer_lock==0){ @@ -290,9 +290,9 @@ int init_timer() *running_timer2=0; for (r=0; rh0[0], &timer_lst->h2[H2_ENTRIES]); return 0; @@ -304,7 +304,7 @@ int init_timer() #ifdef USE_SLOW_TIMER -/* arm the "slow" timer ( start it) +/* arm the "slow" timer ( start it) * returns -1 on error * WARNING: use it in the same process as the timer * (the one using pause(); timer_handler()) or @@ -321,7 +321,7 @@ int arm_slow_timer() } #ifdef __OS_darwin /* workaround for darwin sigwait bug, see slow_timer_main() for more - info (or grep __OS_darwin) */ + * info (or grep __OS_darwin) */ /* keep in sync wih main.c: sig_usr() - signals we are interested in */ sigaddset(&slow_timer_sset, SIGINT); sigaddset(&slow_timer_sset, SIGTERM); @@ -342,7 +342,7 @@ int arm_slow_timer() -/* arm the timer ( start it) +/* arm the timer ( start it) * returns -1 on error * WARNING: use it in the same process as the timer * (the one using pause(); timer_handler()) or @@ -398,7 +398,7 @@ inline static void adjust_ticks(void) ticks_t diff_time_ticks; ticks_t diff_ticks_raw; s_ticks_t delta; - + /* fix ticks if necessary */ if ((*ticks-last_adj_check)>=(ticks_t)TIMER_RESYNC_TICKS){ #ifdef DBG_ser_time @@ -423,7 +423,7 @@ inline static void adjust_ticks(void) if (delta<-1){ LM_WARN("our timer runs faster then real-time" " (%lu ms / %u ticks our time .->" - " %lu ms / %u ticks real time)\n", + " %lu ms / %u ticks real time)\n", (unsigned long)(diff_ticks_raw*1000L/TIMER_TICKS_HZ), diff_ticks_raw, (unsigned long)(diff_time/1000), diff_time_ticks); @@ -463,7 +463,7 @@ time_t ser_time(time_t *t) -/* gettimeofday(2) equivalent, using ser internal timers (faster +/* gettimeofday(2) equivalent, using ser internal timers (faster * but more imprecise) * WARNING: ignores tz (it's obsolete anyway)*/ int ser_gettimeofday(struct timeval* tv, struct timezone* tz) @@ -485,22 +485,22 @@ void check_ser_drift() time_t t1, t2; struct timeval tv1, tv2; int r; - + t1=time(0); t2=ser_time(0); if (t1!=t2) BUG("time(0)!=ser_time(0) : %d != %d \n", (unsigned)t1, (unsigned)t2); - + r=gettimeofday(&tv1, 0); ser_gettimeofday(&tv2, 0); if (tv1.tv_sec!=tv2.tv_sec) BUG("gettimeofday seconds!=ser_gettimeofday seconds : %d != %d \n", (unsigned)tv1.tv_sec, (unsigned)tv2.tv_sec); - else if ((tv1.tv_usec > tv2.tv_usec) && + else if ((tv1.tv_usec > tv2.tv_usec) && (unsigned)(tv1.tv_usec-tv2.tv_usec)>100000) BUG("gettimeofday usecs > ser_gettimeofday with > 0.1s : %d ms\n", (unsigned)(tv1.tv_usec-tv2.tv_usec)/1000); - else if ((tv1.tv_usec < tv2.tv_usec) && + else if ((tv1.tv_usec < tv2.tv_usec) && (unsigned)(tv2.tv_usec-tv1.tv_usec)>100000) BUG("gettimeofday usecs < ser_gettimeofday with > 0.1s : %d ms\n", (unsigned)(tv2.tv_usec-tv1.tv_usec)/1000); @@ -555,7 +555,7 @@ int timer_add_safe(struct timer_ln* tl, ticks_t delta) #endif { int ret; - + LOCK_TIMER_LIST(); if (tl->flags & F_TIMER_ACTIVE){ #ifdef TIMER_DEBUG @@ -600,7 +600,7 @@ int timer_add_safe(struct timer_ln* tl, ticks_t delta) /* safe timer delete * deletes tl and inits the list pointer to 0 - * returns <0 on error (-1 if timer not active/already deleted and -2 if + * returns <0 on error (-1 if timer not active/already deleted and -2 if * delete attempted from the timer handler) and 0 on success */ #ifdef TIMER_DEBUG @@ -611,7 +611,7 @@ int timer_del_safe(struct timer_ln* tl) #endif { int ret; - + ret=-1; again: /* quick exit if timer inactive */ @@ -656,7 +656,7 @@ int timer_del_safe(struct timer_ln* tl) ", last from: %s(%s):%d, deleted %d times" ", last from: %s(%s):%d, init %d times, expired %d \n", tl->add_calls, tl->add_func, tl->add_file, - tl->add_line, tl->del_calls, tl->del_func, + tl->add_line, tl->del_calls, tl->del_func, tl->del_file, tl->del_line, tl->init, tl->expires_no); #endif return -2; /* do nothing */ @@ -680,7 +680,7 @@ int timer_del_safe(struct timer_ln* tl) "already detached\n", tl, tl->next, tl->prev, tl->flags); LOG(timerlog, "WARN: -timer_del-: @%d tl=%p " - "{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), + "{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), tl, tl->next, tl->prev, tl->expire, tl->initial_timeout, tl->data, tl->f, tl->flags); LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n", @@ -726,7 +726,7 @@ int timer_del_safe(struct timer_ln* tl) ", last from: %s(%s):%d, deleted %d times" ", last from: %s(%s):%d, init %d times, expired %d \n", tl->add_calls, tl->add_func, tl->add_file, - tl->add_line, tl->del_calls, tl->del_func, + tl->add_line, tl->del_calls, tl->del_func, tl->del_file, tl->del_line, tl->init, tl->expires_no); #endif return -2; /* do nothing */ @@ -750,7 +750,7 @@ int timer_del_safe(struct timer_ln* tl) "already detached\n", tl, tl->next, tl->prev, tl->flags); LOG(timerlog, "WARN: -timer_del-: @%d tl=%p " - "{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), + "{ %p, %p, %d, %d, %p, %p, %04x, -}\n", get_ticks_raw(), tl, tl->next, tl->prev, tl->expire, tl->initial_timeout, tl->data, tl->f, tl->flags); LOG(timerlog, "WARN: -timer_del-; called from %s(%s):%d\n", @@ -782,10 +782,10 @@ return ret; /* marks a timer as "to be deleted when the handler ends", usefull when - * the timer handler knows it won't prolong the timer anymore (it will + * the timer handler knows it won't prolong the timer anymore (it will * return 0) and will do some time consuming work. Calling this function - * will cause simultaneous timer_dels to return immediately (they won't - * wait anymore for the timer handle to finish). It will also allow + * will cause simultaneous timer_dels to return immediately (they won't + * wait anymore for the timer handle to finish). It will also allow * self-deleting from the timer handle without bug reports. * WARNING: - if you rely on timer_del to know when the timer handle execution * finishes (e.g. to free resources used in the timer handle), don't @@ -802,7 +802,7 @@ void timer_allow_del(void) #ifdef USE_SLOW_TIMER if (IS_IN_TIMER_SLOW()){ UNSET_RUNNING_SLOW(); - }else + }else #endif LM_CRIT("timer_allow_del called outside a timer handle\n"); } @@ -824,10 +824,10 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h #ifdef TIMER_DEBUG struct timer_ln* first; int i=0; - + first=h->next; #endif - + /*LM_DBG("@ ticks = %lu, list =%p\n", (unsigned long) *ticks, h); */ @@ -841,9 +841,9 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h }else if((tl->next==0) || (tl->prev==0)){ LM_CRIT("timer_list_expire: @%d tl=%p " "{ %p, %p, %d, %d, %p, %p, %04x, -}," - " h=%p {%p, %p}\n", t, + " h=%p {%p, %p}\n", t, tl, tl->next, tl->prev, tl->expire, tl->initial_timeout, - tl->data, tl->f, tl->flags, + tl->data, tl->f, tl->flags, h, h->next, h->prev); LM_CRIT("-timer_list_expire-: cycle %d, first %p," "running %p\n", i, first, *running_timer); @@ -869,7 +869,7 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h #ifdef TIMER_DEBUG tl->expires_no++; #endif - UNLOCK_TIMER_LIST(); /* acts also as write barrier */ + UNLOCK_TIMER_LIST(); /* acts also as write barrier */ ret=tl->f(t, tl, tl->data); /* reset the configuration group handles */ cfg_reset_all(); @@ -891,7 +891,7 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h tl->slow_idx=slow_mark; /* current index */ /* overflow check in timer_handler*/ _timer_add_list(slow_l, tl); - + } #endif } @@ -909,11 +909,11 @@ static void timer_handler(void) #ifdef USE_SLOW_TIMER int run_slow_timer; int i; - + run_slow_timer=0; i=(slow_idx_t)(*t_idx%SLOW_LISTS_NO); #endif - + /*LM_DBG("called, ticks=%lu, prev_ticks=%lu\n", (unsigned long)*ticks, (unsigned long)prev_ticks); */ @@ -930,7 +930,7 @@ static void timer_handler(void) } /* go through all the "missed" ticks, taking a possible overflow * into account */ - for (prev_ticks=prev_ticks+1; prev_ticks!=saved_ticks; prev_ticks++) + for (prev_ticks=prev_ticks+1; prev_ticks!=saved_ticks; prev_ticks++) timer_run(prev_ticks); timer_run(prev_ticks); /* do it for saved_ticks too */ }while(saved_ticks!=*ticks); /* in case *ticks changed */ @@ -987,7 +987,7 @@ static ticks_t compat_old_handler(ticks_t ti, struct timer_ln* tl, void * data) { struct sr_timer* t; - + #ifdef TIMER_DEBUG LM_DBG("calling, ticks=%u/%u, tl=%p, t=%p\n", prev_ticks, (unsigned)*ticks, tl, data); @@ -1002,7 +1002,7 @@ static ticks_t compat_old_handler(ticks_t ti, struct timer_ln* tl, /* register a periodic timer; * compatibility mode.w/ the old timer interface... * ret: <0 on error - * Hint: if you need it in a module, register it from mod_init or it + * Hint: if you need it in a module, register it from mod_init or it * won't work otherwise*/ int register_timer(timer_function f, void* param, unsigned int interval) { @@ -1016,13 +1016,13 @@ int register_timer(timer_function f, void* param, unsigned int interval) t->id=timer_id++; t->timer_f=f; t->t_param=param; - + timer_init(&t->tl, compat_old_handler, t, 0); /* is slow */ if (timer_add(&t->tl, S_TO_TICKS(interval))!=0){ LM_ERR("timer_add failed\n"); return -1; } - + return t->id; error: @@ -1083,7 +1083,7 @@ void slow_timer_main() #ifdef USE_SIGWAIT int sig; #endif - + in_slow_timer=1; /* mark this process as the slow timer */ while(1){ #ifdef USE_SIGWAIT @@ -1101,11 +1101,11 @@ void slow_timer_main() if (sig!=SLOW_TIMER_SIG){ #ifdef __OS_darwin /* on darwin sigwait is buggy: it will cause extreme slow down - on signal delivery for the signals it doesn't wait on - (on darwin 8.8.0, g4 1.5Ghz I've measured a 36s delay!). - To work arround this bug, we sigwait() on all the signals we - are interested in ser and manually call the master signal handler - if the signal!= slow timer signal -- andrei */ + * on signal delivery for the signals it doesn't wait on + * (on darwin 8.8.0, g4 1.5Ghz I've measured a 36s delay!). + * To work arround this bug, we sigwait() on all the signals we + * are interested in ser and manually call the master signal handler + * if the signal!= slow timer signal -- andrei */ sig_usr(sig); #endif continue; @@ -1113,7 +1113,7 @@ void slow_timer_main() #endif /* update the local cfg if needed */ cfg_update(); - + LOCK_SLOW_TIMER_LIST(); while(*s_idx!=*t_idx){ i= *s_idx%SLOW_LISTS_NO; @@ -1150,7 +1150,7 @@ void slow_timer_main() } UNLOCK_SLOW_TIMER_LIST(); } - + } #endif diff --git a/timer.h b/timer.h index 36a31710051..6414fb106b9 100644 --- a/timer.h +++ b/timer.h @@ -15,8 +15,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** @@ -41,8 +41,8 @@ #ifndef timer_h #define timer_h -#define USE_SLOW_TIMER /* use another process to run the timer handlers - marked "slow" */ +#define USE_SLOW_TIMER /* use another process to run the timer handlers + * marked "slow" */ /*#define TIMER_DEBUG -- compile with -DTIMER_DEBUG*/ #include "clist.h" @@ -62,7 +62,7 @@ extern pid_t slow_timer_pid; /* deprecated, old, kept for compatibility */ typedef void (timer_function)(unsigned int ticks, void* param); -/* deprecated, old, kept for compatibility +/* deprecated, old, kept for compatibility get_ticks()*TIMER_TICK used to be the time in s for new code, use get_ticks_raw() and one of the macros defined in timer_ticks.h (.e.g TICKS_TO_S(tick) to convert to s or ms )*/ @@ -72,7 +72,7 @@ typedef void (timer_function)(unsigned int ticks, void* param); typedef void (utimer_function)(unsigned int uticks, void* param); struct timer_ln; /* forward decl */ -/* new +/* new * params: * - handle pointer to the corresponding struct timer_ln * return: 0 if the timer is one shot, new expire interval if not, -1 @@ -89,19 +89,19 @@ typedef ticks_t (timer_handler_f)(ticks_t t, struct timer_ln* tl, /* timer flags */ #define F_TIMER_FAST 1 #define F_TIMER_ON_SLOW_LIST 0x100 -#define F_TIMER_ACTIVE 0x200 /* timer is running or has run and expired - (one shot) */ +#define F_TIMER_ACTIVE 0x200 /* timer is running or has run and expired + * (one shot) */ #ifdef TIMER_DEBUG -#define F_TIMER_DELETED 0x400 +#define F_TIMER_DELETED 0x400 #endif struct timer_ln{ /* timer_link already used in tm */ struct timer_ln* next; struct timer_ln* prev; - ticks_t expire; + ticks_t expire; ticks_t initial_timeout; void* data; - timer_handler_f* f; + timer_handler_f* f; volatile unsigned short flags; #ifdef USE_SLOW_TIMER volatile slow_idx_t slow_idx; @@ -145,14 +145,14 @@ void timer_free(struct timer_ln* t); #define timer_reinit(tl) \ do{ \ (tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \ - F_TIMER_ACTIVE));\ + F_TIMER_ACTIVE));\ (tl)->init++; \ }while(0) #else /* use for a deleted/expired timer that you want to add again */ #define timer_reinit(tl) \ (tl)->flags&=~((unsigned short)(F_TIMER_ON_SLOW_LIST | \ - F_TIMER_ACTIVE)) + F_TIMER_ACTIVE)) #endif #define timer_init(tl, fun, param, flgs) \ @@ -165,7 +165,7 @@ void timer_free(struct timer_ln* t); }while(0) #ifdef TIMER_DEBUG -int timer_add_safe(struct timer_ln *tl, ticks_t delta, +int timer_add_safe(struct timer_ln *tl, ticks_t delta, const char*, const char*, unsigned); int timer_del_safe(struct timer_ln *tl, const char*, const char*, unsigned); diff --git a/timer_funcs.h b/timer_funcs.h index 05a42abe25f..fd6757094b4 100644 --- a/timer_funcs.h +++ b/timer_funcs.h @@ -15,8 +15,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -58,7 +58,7 @@ struct timer_head{ /*@{ */ #define H0_BITS 14 -#define H1_BITS 9 +#define H1_BITS 9 #define H2_BITS (32-H1_BITS-H0_BITS) @@ -139,7 +139,7 @@ static inline void timer_redist(ticks_t t, struct timer_head *h) { struct timer_ln* tl; struct timer_ln* tmp; - + timer_foreach_safe(tl, tmp, h){ _timer_dist_tl(tl, tl->expire-t); } @@ -156,7 +156,7 @@ static inline void timer_run(ticks_t t) if ((t & H1_H0_MASK)==0){ /*r2*/ timer_redist(t, &timer_lst->h2[t>>(H0_BITS+H1_BITS)]); } - + timer_redist(t, &timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]);/*r2 >> H0*/ } /* @@ -171,7 +171,7 @@ static inline void timer_lst_mv0(ticks_t t, struct timer_head* h) { struct timer_ln* tl; struct timer_ln* tmp; - + timer_foreach_safe(tl, tmp, h){ _timer_dist_tl(tl, &timer_lst->h0[tl->expire & H0_MASK]); } @@ -183,12 +183,12 @@ static inline void timer_lst_mv1(ticks_t t, struct timer_head* h) { struct timer_ln* tl; struct timer_ln* tmp; - + timer_foreach_safe(tl, tmp, h){ if ((tl->expire & H0_MASK)==0) /* directly to h0 */ _timer_add_list(tl, &timer_lst->h0[tl->expire & H0_MASK]); else /* to h1 */ - _timer_add_list(tl, + _timer_add_list(tl, &timer_lst->h1[(tl->expire & H1_H0_MASK)>>H0_BITS]); } /* clear the current list */ @@ -203,7 +203,7 @@ static inline void timer_run(ticks_t t) if ((t & H0_MASK)==0){ /*r1*/ if ((t & H1_H0_MASK)==0) /*r2*/ /* just move the list "down" to hash1 */ - timer_lst_mv1(&timer_lst->h2[t>>(H0_BITS+H1_BITS)]); + timer_lst_mv1(&timer_lst->h2[t>>(H0_BITS+H1_BITS)]); /* move "down" to hash0 */ timer_lst_mv0(&timer_lst->h1[(t & H1_H0_MASK)>>H0_BITS]); } diff --git a/timer_proc.c b/timer_proc.c index 272cc76dbd8..5b8374fc4d2 100644 --- a/timer_proc.c +++ b/timer_proc.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2009 iptelorg GmbH * * Permission to use, copy, modify, and distribute this software for any @@ -48,8 +48,8 @@ int register_basic_timers(int timers) /** * \brief Forks a separate simple sleep() periodic timer - * - * Forks a very basic periodic timer process, that just sleep()s for + * + * Forks a very basic periodic timer process, that just sleep()s for * the specified interval and then calls the timer function. * The new "basic timer" process execution start immediately, the sleep() * is called first (so the first call to the timer function will happen @@ -67,7 +67,7 @@ int fork_basic_timer(int child_id, char* desc, int make_sock, timer_function* f, void* param, int interval) { int pid; - + pid=fork_process(child_id, desc, make_sock); if (pid<0) return -1; if (pid==0){ @@ -77,7 +77,7 @@ int fork_basic_timer(int child_id, char* desc, int make_sock, sleep(interval); cfg_update(); f(get_ticks(), param); /* ticks in s for compatibility with old - timers */ + * timers */ } } /* parent */ @@ -86,8 +86,8 @@ int fork_basic_timer(int child_id, char* desc, int make_sock, /** * \brief Forks a separate simple microsecond-sleep() periodic timer - * - * Forks a very basic periodic timer process, that just us-sleep()s for + * + * Forks a very basic periodic timer process, that just us-sleep()s for * the specified interval and then calls the timer function. * The new "basic timer" process execution start immediately, the us-sleep() * is called first (so the first call to the timer function will happen @@ -106,7 +106,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, { int pid; ticks_t ts; - + pid=fork_process(child_id, desc, make_sock); if (pid<0) return -1; if (pid==0){ @@ -126,7 +126,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, /** * \brief Forks a timer process based on the local timer - * + * * Forks a separate timer process running a local_timer.h type of timer * A pointer to the local_timer handle (allocated in shared memory) is * returned in lt_h. It can be used to add/delete more timers at runtime @@ -135,10 +135,10 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, * used (all the calls to local_timer* must be enclosed by locks if it * cannot be guaranteed that they cannot execute in the same time) * The timer "engine" must be run manually from the child process. For - * example a very simple local timer process that just runs a single + * example a very simple local timer process that just runs a single * periodic timer can be started in the following way: * struct local_timer* lt_h; - * + * * pid=fork_local_timer_process(...., <_h); * if (pid==0){ * timer_init(&my_timer, my_timer_f, 0, 0); @@ -157,7 +157,7 @@ int fork_local_timer_process(int child_id, char* desc, int make_sock, { int pid; struct local_timer* lt; - + lt=shm_malloc(sizeof(*lt)); if (lt==0) goto error; if (init_local_timer(lt, get_ticks_raw())<0) goto error; @@ -186,7 +186,7 @@ int register_sync_timers(int timers) /** * \brief Forks a separate simple sleep() -&- sync periodic timer * - * Forks a very basic periodic timer process, that just sleep()s for + * Forks a very basic periodic timer process, that just sleep()s for * the specified interval and then calls the timer function. * The new "sync timer" process execution start immediately, the sleep() * is called first (so the first call to the timer function will happen @@ -222,7 +222,7 @@ int fork_sync_timer(int child_id, char* desc, int make_sock, ts1 = get_ticks_raw(); cfg_update(); f(TICKS_TO_S(ts1), param); /* ticks in sec for compatibility with old - timers */ + * timers */ /* adjust the next sleep duration */ ts2 = interval - TICKS_TO_MS(get_ticks_raw()) + TICKS_TO_MS(ts1); } @@ -235,7 +235,7 @@ int fork_sync_timer(int child_id, char* desc, int make_sock, /** * \brief Forks a separate simple microsecond-sleep() -&- sync periodic timer * - * Forks a very basic periodic timer process, that just us-sleep()s for + * Forks a very basic periodic timer process, that just us-sleep()s for * the specified interval and then calls the timer function. * The new "sync timer" process execution start immediately, the us-sleep() * is called first (so the first call to the timer function will happen diff --git a/timer_proc.h b/timer_proc.h index 37f14b25c89..baaf3665644 100644 --- a/timer_proc.h +++ b/timer_proc.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2009 iptelorg GmbH * * Permission to use, copy, modify, and distribute this software for any @@ -41,8 +41,8 @@ int register_basic_timers(int timers); /** * \brief Forks a separate simple sleep() periodic timer - * - * Forks a very basic periodic timer process, that just sleep()s for + * + * Forks a very basic periodic timer process, that just sleep()s for * the specified interval and then calls the timer function. * The new "basic timer" process execution start immediately, the sleep() * is called first (so the first call to the timer function will happen @@ -63,8 +63,8 @@ int fork_basic_timer(int child_id, char* desc, int make_sock, /** * \brief Forks a separate simple milisecond-sleep() periodic timer - * - * Forks a very basic periodic timer process, that just ms-sleep()s for + * + * Forks a very basic periodic timer process, that just ms-sleep()s for * the specified interval and then calls the timer function. * The new "basic timer" process execution start immediately, the ms-sleep() * is called first (so the first call to the timer function will happen @@ -82,7 +82,7 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, timer_function* f, void* param, int uinterval); /** * \brief Forks a timer process based on the local timer - * + * * Forks a separate timer process running a local_timer.h type of timer * A pointer to the local_timer handle (allocated in shared memory) is * returned in lt_h. It can be used to add/delete more timers at runtime @@ -91,10 +91,10 @@ int fork_basic_utimer(int child_id, char* desc, int make_sock, * used (all the calls to local_timer* must be enclosed by locks if it * cannot be guaranteed that they cannot execute in the same time) * The timer "engine" must be run manually from the child process. For - * example a very simple local timer process that just runs a single + * example a very simple local timer process that just runs a single * periodic timer can be started in the following way: * struct local_timer* lt_h; - * + * * pid=fork_local_timer_process(...., <_h); * if (pid==0){ * timer_init(&my_timer, my_timer_f, 0, 0); diff --git a/timer_ticks.h b/timer_ticks.h index cdc5588cde2..ae036441b34 100644 --- a/timer_ticks.h +++ b/timer_ticks.h @@ -15,8 +15,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /**