Skip to content

Commit

Permalink
timer: Refine itimer_armed logic and improve timer value handling
Browse files Browse the repository at this point in the history
Right now, CRIU skips timers non-periodic timers. This change addresses
this issue.

Signed-off-by: Austin Kuo <[email protected]>
  • Loading branch information
hckuo authored and avagin committed Jan 22, 2025
1 parent 637682d commit 5eee7a6
Show file tree
Hide file tree
Showing 2 changed files with 2 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 @@ -2226,7 +2226,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
2 changes: 1 addition & 1 deletion criu/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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 5eee7a6

Please sign in to comment.