implement a timer_list check before we return into the select() loop
this helps us to debug timer_list corruption
diff --git a/openbsc/src/select.c b/openbsc/src/select.c
index 7f45426..c11f3a5 100644
--- a/openbsc/src/select.c
+++ b/openbsc/src/select.c
@@ -78,6 +78,8 @@
FD_SET(ufd->fd, &exceptset);
}
+ bsc_timer_check();
+
if (!polling)
bsc_prepare_timers();
rc = select(maxfd+1, &readset, &writeset, &exceptset, polling ? &no_time : bsc_nearest_timer());
diff --git a/openbsc/src/timer.c b/openbsc/src/timer.c
index a942ffd..6f974a2 100644
--- a/openbsc/src/timer.c
+++ b/openbsc/src/timer.c
@@ -172,3 +172,14 @@
return work;
}
+
+int bsc_timer_check(void)
+{
+ struct timer_list *timer;
+ int i;
+
+ llist_for_each_entry(timer, &timer_list, entry) {
+ i++;
+ }
+ return i;
+}