diff -ru linuxthreads-2.2.5-orig/sysdeps/pthread/posix-timer.h linuxthreads-2.2.5-timer-mods/sysdeps/pthread/posix-timer.h --- linuxthreads-2.2.5-orig/sysdeps/pthread/posix-timer.h Mon Jun 19 20:32:05 2000 +++ linuxthreads-2.2.5-timer-mods/sysdeps/pthread/posix-timer.h Mon Apr 8 10:54:19 2002 @@ -65,6 +65,7 @@ struct thread_node *thread; pid_t creator_pid; int refcount; + int overrun_count; }; diff -ru linuxthreads-2.2.5-orig/sysdeps/pthread/timer_getoverr.c linuxthreads-2.2.5-timer-mods/sysdeps/pthread/timer_getoverr.c --- linuxthreads-2.2.5-orig/sysdeps/pthread/timer_getoverr.c Tue Apr 24 09:29:35 2001 +++ linuxthreads-2.2.5-timer-mods/sysdeps/pthread/timer_getoverr.c Mon Apr 8 10:55:00 2002 @@ -37,7 +37,7 @@ if (! timer_valid (timer = timer_id2ptr (timerid))) __set_errno (EINVAL); else - retval = 0; /* TODO: overrun counting not supported */ + retval = timer->overrun_count; pthread_mutex_unlock (&__timer_mutex); diff -ru linuxthreads-2.2.5-orig/sysdeps/pthread/timer_routines.c linuxthreads-2.2.5-timer-mods/sysdeps/pthread/timer_routines.c --- linuxthreads-2.2.5-orig/sysdeps/pthread/timer_routines.c Sat Apr 21 16:42:42 2001 +++ linuxthreads-2.2.5-timer-mods/sysdeps/pthread/timer_routines.c Mon Apr 8 15:48:56 2002 @@ -413,8 +413,16 @@ if (__builtin_expect (timer->value.it_interval.tv_sec, 0) != 0 || timer->value.it_interval.tv_nsec != 0) { - timespec_add (&timer->expirytime, &now, - &timer->value.it_interval); + timer->overrun_count = 0; + timespec_add (&timer->expirytime, &timer->expirytime, + &timer->value.it_interval); // i++ equivalent + while (timespec_compare(&timer->expirytime, &now) < 0) { + timespec_add (&timer->expirytime, &timer->expirytime, + &timer->value.it_interval); + if (timer->overrun_count < _POSIX_DELAYTIMER_MAX) { + timer->overrun_count++; + } + } __timer_thread_queue_timer (self, timer); }