Skip to content

Commit

Permalink
timer: update timer handling to properly C/R non-periodic timers
Browse files Browse the repository at this point in the history
Right now, CRIU skips timers non-periodic timers. This change addresses
this issue.
  • Loading branch information
hckuo authored and avagin committed Jan 17, 2025
1 parent d46cbf7 commit 167dcc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion criu/pie/restorer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2210,7 +2210,7 @@ __visible long __export_restore_task(struct task_restore_args *args)
* code below doesn't fail due to bad timing values.
*/

#define itimer_armed(args, i) (args->itimers[i].it_interval.tv_sec || args->itimers[i].it_interval.tv_usec)
#define itimer_armed(args, i) (args->itimers[i].it_value.tv_sec || args->itimers[i].it_value.tv_usec)

if (itimer_armed(args, 0))
sys_setitimer(ITIMER_REAL, &args->itimers[0], NULL);
Expand Down
3 changes: 2 additions & 1 deletion criu/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ static inline int timeval_valid(struct timeval *tv)

static inline int decode_itimer(char *n, ItimerEntry *ie, struct itimerval *val)
{
if (ie->isec == 0 && ie->iusec == 0) {
if (ie->isec == 0 && ie->iusec == 0 &&
ie->vsec == 0 && ie->vusec == 0) {
memzero_p(val);
return 0;
}
Expand Down

0 comments on commit 167dcc9

Please sign in to comment.