[CRIU] [PATCH 06/12] posix-timer: Get info in parasite, and structures

Pavel Tikhomirov snorcht at gmail.com
Wed May 29 19:36:15 EDT 2013


Signed-off-by: Pavel Tikhomirov <snorcht at gmail.com>
---
 include/parasite.h |   14 ++++++++++++++
 pie/parasite.c     |   25 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/include/parasite.h b/include/parasite.h
index 0e5720f..264d276 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -13,6 +13,8 @@
 #include "image.h"
 #include "util-net.h"
 
+#include <time.h>
+
 #include "protobuf/vma.pb-c.h"
 
 #define __head __used __section(.head.text)
@@ -39,6 +41,7 @@ enum {
 
 	PARASITE_CMD_DUMP_SIGACTS,
 	PARASITE_CMD_DUMP_ITIMERS,
+	PARASITE_CMD_DUMP_POSIX_TIMERS,
 	PARASITE_CMD_DUMP_MISC,
 	PARASITE_CMD_DUMP_CREDS,
 	PARASITE_CMD_DUMP_THREAD,
@@ -120,6 +123,17 @@ struct parasite_dump_itimers_args {
 	struct itimerval prof;
 };
 
+struct posix_timer {
+	int it_id;
+	struct itimerspec val;
+	int overrun;
+};
+
+struct parasite_dump_posix_timers_args {
+	int timer_n;
+	struct posix_timer timer[0];
+};
+
 /*
  * Misc sfuff, that is too small for separate file, but cannot
  * be read w/o using parasite
diff --git a/pie/parasite.c b/pie/parasite.c
index 513a851..0ae0129 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -103,6 +103,28 @@ static int dump_itimers(struct parasite_dump_itimers_args *args)
 	return ret;
 }
 
+static int dump_posix_timers(struct parasite_dump_posix_timers_args *args)
+{
+	int i;
+	int ret = 0;
+
+	for(i = 0; i < args->timer_n; i++){
+		ret = sys_timer_gettime(args->timer[i].it_id, &args->timer[i].val);
+		if (ret < 0) {
+			pr_err("sys_timer_gettime failed\n");
+			return ret;
+		}
+		args->timer[i].overrun = sys_timer_getoverrun(args->timer[i].it_id);
+		ret = args->timer[i].overrun;
+		if (ret < 0) {
+			pr_err("sys_timer_getoverrun failed\n");
+			return ret;
+		}
+	}
+
+	return ret;
+}
+
 static int dump_misc(struct parasite_dump_misc *args)
 {
 	args->brk = sys_brk(0);
@@ -491,6 +513,9 @@ static noinline __used int noinline parasite_daemon(void *args)
 		case PARASITE_CMD_DUMP_ITIMERS:
 			ret = dump_itimers(args);
 			break;
+		case PARASITE_CMD_DUMP_POSIX_TIMERS:
+			ret = dump_posix_timers(args);
+			break;
 		case PARASITE_CMD_DUMP_MISC:
 			ret = dump_misc(args);
 			break;
-- 
1.7.9.5



More information about the CRIU mailing list