[CRIU] [crtools-bot] parasite: Dump misc command
Cyrill Gorcunov
gorcunov at openvz.org
Mon Jan 30 03:59:54 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 47c161f2dcd43a54b1658dfdbe1e806318ce890f
Author: Pavel Emelyanov <xemul at openvz.org>
Date: Fri Jan 27 21:35:59 2012 +0400
parasite: Dump misc command
Add command and basis for dumping minor bits for task
from parasite code. It's supposed to retrieve minor bits
form tasks which cannot be read from /proc.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-dump.c | 8 ++++++++
include/parasite-syscall.h | 3 +++
include/parasite.h | 10 ++++++++++
parasite-syscall.c | 6 ++++++
parasite.c | 10 ++++++++++
5 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 5e1642a..df12fd2 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include <parasite.h>
#include <fcntl.h>
@@ -1142,6 +1143,7 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
struct parasite_ctl *parasite_ctl;
int ret = -1;
int pid_dir;
+ struct parasite_dump_misc misc;
pr_info("========================================\n");
pr_info("Dumping task (pid: %d)\n", pid);
@@ -1217,6 +1219,12 @@ static int dump_one_task(struct pstree_item *item, struct cr_fdset *cr_fdset)
goto err;
}
+ ret = parasite_dump_misc_seized(parasite_ctl, &misc);
+ if (ret) {
+ pr_err("Can't dump misc (pid: %d)\n", pid);
+ goto err;
+ }
+
ret = parasite_cure_seized(parasite_ctl, &vma_area_list);
if (ret) {
pr_err("Can't cure (pid: %d) from parasite\n", pid);
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index 6b506c0..0ab9fe5 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -41,6 +41,9 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head
extern int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset);
extern int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset);
+struct parasite_dump_misc;
+extern int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_dump_misc *);
+
extern struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_area_list);
extern int parasite_cure_seized(struct parasite_ctl *ctl, struct list_head *vma_area_list);
diff --git a/include/parasite.h b/include/parasite.h
index 0bdafa5..dc124a7 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -35,6 +35,7 @@ enum {
PARASITE_CMD_DUMPPAGES,
PARASITE_CMD_DUMP_SIGACTS,
PARASITE_CMD_DUMP_ITIMERS,
+ PARASITE_CMD_DUMP_MISC,
PARASITE_CMD_MAX,
};
@@ -74,6 +75,15 @@ struct parasite_dump_pages_args {
};
/*
+ * Misc sfuff, that is too small for separate file, but cannot
+ * be read w/o using parasite
+ */
+
+struct parasite_dump_misc {
+ parasite_status_t status;
+};
+
+/*
* Some useful offsets
*/
diff --git a/parasite-syscall.c b/parasite-syscall.c
index acf2249..6b3e0e7 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -393,6 +393,12 @@ int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
return parasite_file_cmd(PARASITE_CMD_DUMP_ITIMERS, CR_FD_ITIMERS, ctl, cr_fdset);
}
+int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_dump_misc *misc)
+{
+ return parasite_execute(PARASITE_CMD_DUMP_MISC, ctl,
+ (parasite_status_t *)misc, sizeof(struct parasite_dump_misc));
+}
+
/*
* This routine drives parasite code (been previously injected into a victim
* process) and tells it to dump pages into the file.
diff --git a/parasite.c b/parasite.c
index ac9d122..583604b 100644
--- a/parasite.c
+++ b/parasite.c
@@ -348,6 +348,14 @@ err_close:
return ret;
}
+static int dump_misc(struct parasite_dump_misc *args)
+{
+ parasite_status_t *st = &args->status;
+
+ SET_PARASITE_STATUS(st, 0, 0);
+ return 0;
+}
+
static int __used parasite_service(unsigned long cmd, void *args, void *brk)
{
brk_init(brk);
@@ -367,6 +375,8 @@ static int __used parasite_service(unsigned long cmd, void *args, void *brk)
return dump_sigact((struct parasite_dump_file_args *)args);
case PARASITE_CMD_DUMP_ITIMERS:
return dump_itimers((struct parasite_dump_file_args *)args);
+ case PARASITE_CMD_DUMP_MISC:
+ return dump_misc((struct parasite_dump_misc *)args);
default:
sys_write_msg("Unknown command to parasite\n");
break;
More information about the CRIU
mailing list