[CRIU] [PATCH] zdtm: Add CLOCK_BOOTTIME test into posix_timers

Cyrill Gorcunov gorcunov at openvz.org
Tue Jun 17 03:38:43 PDT 2014


To test CLOCK_BOOTTIME feature recently implemented in OpenVZ kernel.
Vanilla kernel and CRIU passes it.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/live/static/posix_timers.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/test/zdtm/live/static/posix_timers.c b/test/zdtm/live/static/posix_timers.c
index c9dbda9119a8..bc412e4e931e 100644
--- a/test/zdtm/live/static/posix_timers.c
+++ b/test/zdtm/live/static/posix_timers.c
@@ -23,17 +23,21 @@ sigset_t mask;
 #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);
+static void boottime_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);
+static void boottime_oneshot_handler(int sig, siginfo_t *si, void *uc);
 
 enum {
 #ifndef NO_PERIODIC
 	REALTIME_PERIODIC_INFO,
 	MONOTONIC_PERIODIC_INFO,
+	BOOTTIME_PERIODIC_INFO,
 #endif
 	REALTIME_ONESHOT_INFO,
 	MONOTONIC_ONESHOT_INFO,
+	BOOTTIME_ONESHOT_INFO,
 };
 
 static struct posix_timers_info {
@@ -55,11 +59,15 @@ static struct posix_timers_info {
 				realtime_periodic_handler, SIGALRM, 0, 1},
 	[MONOTONIC_PERIODIC_INFO] = {CLOCK_MONOTONIC, "MONOTONIC (periodic)",
 				monotonic_periodic_handler, SIGINT, 0, 3},
+	[BOOTTIME_PERIODIC_INFO] = {CLOCK_BOOTTIME, "BOOTTIME (periodic)",
+				boottime_periodic_handler, SIGWINCH, 0, 3},
 #endif
 	[REALTIME_ONESHOT_INFO] = {CLOCK_REALTIME, "REALTIME (oneshot)",
 				realtime_oneshot_handler, SIGUSR1, 1, INT_MAX},
 	[MONOTONIC_ONESHOT_INFO] = {CLOCK_MONOTONIC, "MONOTONIC (oneshot)",
 				monotonic_oneshot_handler, SIGUSR2, 1, INT_MAX},
+	[BOOTTIME_ONESHOT_INFO] = {CLOCK_BOOTTIME, "BOOTTIME (oneshot)",
+				boottime_oneshot_handler, SIGPROF, 1, INT_MAX },
 	{ }
 };
 
@@ -196,6 +204,12 @@ 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);
 }
+
+static void boottime_periodic_handler(int sig, siginfo_t *si, void *uc)
+{
+	generic_handler(si->si_value.sival_ptr,
+			&posix_timers[BOOTTIME_PERIODIC_INFO], sig);
+}
 #endif
 
 static void monotonic_oneshot_handler(int sig, siginfo_t *si, void *uc)
@@ -204,6 +218,12 @@ static void monotonic_oneshot_handler(int sig, siginfo_t *si, void *uc)
 			&posix_timers[MONOTONIC_ONESHOT_INFO], sig);
 }
 
+static void boottime_oneshot_handler(int sig, siginfo_t *si, void *uc)
+{
+	generic_handler(si->si_value.sival_ptr,
+			&posix_timers[BOOTTIME_ONESHOT_INFO], sig);
+}
+
 #ifndef NO_PERIODIC
 static void realtime_periodic_handler(int sig, siginfo_t *si, void *uc)
 {
-- 
1.9.3



More information about the CRIU mailing list