| 218 | |
| 219 | |
| 220 | static inline struct os_timer* new_os_timer(char *label, unsigned short flags, |
| 221 | timer_function f, void* param, unsigned int interval) |
| 222 | { |
| 223 | struct os_timer* t; |
| 224 | |
| 225 | if (label==NULL) |
| 226 | label = "n/a"; |
| 227 | |
| 228 | t=shm_malloc( sizeof(struct os_timer) + strlen(label)+1 ); |
| 229 | if (t==0){ |
| 230 | LM_ERR("out of pkg memory\n"); |
| 231 | return NULL; |
| 232 | } |
| 233 | t->id=timer_id++; |
| 234 | t->flags = flags; |
| 235 | t->label = (char*)(t+1); |
| 236 | strcpy( t->label, label); |
| 237 | t->u.timer_f=f; |
| 238 | t->t_param=param; |
| 239 | t->interval=interval; |
| 240 | t->expires=*jiffies+interval; |
| 241 | t->trigger_time = 0; |
| 242 | t->time = 0; |
| 243 | return t; |
| 244 | } |
| 245 | |
| 246 | |
| 247 | /*register a periodic timer; |
no test coverage detected