2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

posix-timer: Add test non consequent timer ids

Add fake timers to inshure that then timer ids don't go one after
another c/r go well.

Signed-off-by: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Tikhomirov
2013-06-27 23:32:27 +04:00
committed by Pavel Emelyanov
parent b782b982bd
commit f8bb9c3653

View File

@@ -205,6 +205,8 @@ static void realtime_oneshot_handler(int sig, siginfo_t *si, void *uc)
static int setup_timers(void)
{
int i;
int ret;
struct posix_timers_info *info = posix_timers;
struct sigevent sev;
struct itimerspec its;
@@ -222,6 +224,21 @@ static int setup_timers(void)
info = posix_timers;
while(info->handler) {
/* Add and delete fake timers to test restoring 'with holes' */
timer_t timeridt;
for (i = 0; i < 10; i++) {
ret = timer_create(CLOCK_REALTIME, NULL, &timeridt);
if (ret < 0) {
err("Can't create temporary posix timer %lx\n", (long) timeridt);
return -errno;
}
ret = timer_delete(timeridt);
if (ret < 0) {
err("Can't remove temporaty posix timer %lx\n", (long) timeridt);
return -errno;
}
}
info->sa.sa_flags = SA_SIGINFO;
info->sa.sa_sigaction = info->handler;
sigemptyset(&info->sa.sa_mask);