[CRIU] [PATCH 12/12] posix-timer: Add macros to exclude periodic

Andrew Vagin avagin at parallels.com
Mon Jul 1 09:20:18 EDT 2013


On Thu, Jun 27, 2013 at 11:32:28PM +0400, Pavel Tikhomirov wrote:
> Explanation of exclude periodic test is that we can't set overrun for
> timer, so all checks will fail in case of big overrun before dump.
> 
> Signed-off-by: Pavel Tikhomirov <snorcht at gmail.com>
> ---
>  test/zdtm/live/static/posix_timers.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/test/zdtm/live/static/posix_timers.c b/test/zdtm/live/static/posix_timers.c
> index 31573f6..4ff5d03 100644
> --- a/test/zdtm/live/static/posix_timers.c
> +++ b/test/zdtm/live/static/posix_timers.c
> @@ -18,15 +18,20 @@ sigset_t mask;
>  #define FAIL_OVERRUN		4
>  
>  #define MAX_TIMER_DISPLACEMENT	10
> +#define NO_PERIODIC

zdtm is used for testing OpenVZ Checkpointing, so you can't define
NO_PERIODIC here. I think we can set this parameter in CRIU Makefile.
By default NO_PERIODIC should be undefined.

>  
> +#ifndef NO_PERIODIC
>  static void realtime_periodic_handler(int sig, siginfo_t *si, void *uc);
>  static void monotonic_periodic_handler(int sig, siginfo_t *si, void *uc);
> +#endif
>  static void realtime_oneshot_handler(int sig, siginfo_t *si, void *uc);
>  static void monotonic_oneshot_handler(int sig, siginfo_t *si, void *uc);
>  
>  enum {
> +#ifndef NO_PERIODIC
>  	REALTIME_PERIODIC_INFO,
>  	MONOTONIC_PERIODIC_INFO,
> +#endif
>  	REALTIME_ONESHOT_INFO,
>  	MONOTONIC_ONESHOT_INFO,
>  };
> @@ -45,10 +50,12 @@ static struct posix_timers_info {
>  	int overrun;
>  	struct timespec start, end;
>  } posix_timers[] = {
> +#ifndef NO_PERIODIC
>  	[REALTIME_PERIODIC_INFO] = {CLOCK_REALTIME, "REALTIME (periodic)",
>  				realtime_periodic_handler, SIGALRM, 0, 1},
>  	[MONOTONIC_PERIODIC_INFO] = {CLOCK_MONOTONIC, "MONOTONIC (periodic)",
>  				monotonic_periodic_handler, SIGINT, 0, 3},
> +#endif
>  	[REALTIME_ONESHOT_INFO] = {CLOCK_REALTIME, "REALTIME (oneshot)",
>  				realtime_oneshot_handler, SIGUSR1, 1, INT_MAX},
>  	[MONOTONIC_ONESHOT_INFO] = {CLOCK_MONOTONIC, "MONOTONIC (oneshot)",
> @@ -179,11 +186,13 @@ static void generic_handler(struct posix_timers_info *info,
>  	info->handler_cnt++;
>  }
>  
> +#ifndef NO_PERIODIC
>  static void monotonic_periodic_handler(int sig, siginfo_t *si, void *uc)
>  {
>  	generic_handler(si->si_value.sival_ptr,
>  			&posix_timers[MONOTONIC_PERIODIC_INFO], sig);
>  }
> +#endif
>  
>  static void monotonic_oneshot_handler(int sig, siginfo_t *si, void *uc)
>  {
> @@ -191,11 +200,13 @@ static void monotonic_oneshot_handler(int sig, siginfo_t *si, void *uc)
>  			&posix_timers[MONOTONIC_ONESHOT_INFO], sig);
>  }
>  
> +#ifndef NO_PERIODIC
>  static void realtime_periodic_handler(int sig, siginfo_t *si, void *uc)
>  {
>  	generic_handler(si->si_value.sival_ptr,
>  			&posix_timers[REALTIME_PERIODIC_INFO], sig);
>  }
> +#endif
>  
>  static void realtime_oneshot_handler(int sig, siginfo_t *si, void *uc)
>  {
> -- 
> 1.7.9.5
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list