[CRIU] [PATCH 05/12] posix-timer: Get info in parasite, and structures
Pavel Tikhomirov
snorcht at gmail.com
Thu Jun 27 12:32:21 EDT 2013
Signed-off-by: Pavel Tikhomirov <snorcht at gmail.com>
---
include/parasite.h | 18 ++++++++++++++++++
pie/parasite.c | 25 +++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/include/parasite.h b/include/parasite.h
index 25bb7b9..fe25299 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -9,6 +9,7 @@
#ifndef __ASSEMBLY__
#include <sys/un.h>
+#include <time.h>
#include "image.h"
#include "util-net.h"
@@ -39,6 +40,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,
@@ -117,6 +119,22 @@ 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];
+};
+
+static inline int posix_timers_dump_size(int timer_n)
+{
+ return sizeof(int) + sizeof(struct posix_timer) * timer_n;
+}
+
/*
* 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 1d2fbef..3f41341 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -114,6 +114,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);
@@ -510,6 +532,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