[CRIU] [PATCH v4 28/31] rst: Pass pstree_item argument to alloc_groups_copy_creds()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Feb 22 03:34:41 PST 2017
Pass the arg and add const modifiers where they are need.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cgroup.c | 2 +-
criu/cr-dump.c | 6 +++---
criu/include/cgroup.h | 2 +-
criu/include/parasite-syscall.h | 4 ++--
criu/parasite-syscall.c | 13 +++++++------
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/criu/cgroup.c b/criu/cgroup.c
index c4eea8dcc..a1b3eb23f 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -632,7 +632,7 @@ static int collect_cgroups(struct list_head *ctls)
return 0;
}
-int dump_task_cgroup(struct pstree_item *item, u32 *cg_id, struct parasite_dump_cgroup_args *args)
+int dump_task_cgroup(const struct pstree_item *item, u32 *cg_id, struct parasite_dump_cgroup_args *args)
{
int pid;
LIST_HEAD(ctls);
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index ccc1b7b2b..5f1f668bb 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -694,7 +694,7 @@ int dump_thread_core(int pid, CoreEntry *core, const struct parasite_dump_thread
}
static int dump_task_core_all(struct parasite_ctl *ctl,
- struct pstree_item *item,
+ const struct pstree_item *item,
const struct proc_pid_stat *stat,
const struct cr_imgset *cr_imgset)
{
@@ -732,7 +732,7 @@ static int dump_task_core_all(struct parasite_ctl *ctl,
core->tc->task_state = item->pid->state;
core->tc->exit_code = 0;
- ret = parasite_dump_thread_leader_seized(ctl, pid, core);
+ ret = parasite_dump_thread_leader_seized(ctl, item, pid, core);
if (ret)
goto err;
@@ -831,7 +831,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl,
pr_info("Dumping core for thread (pid: %d)\n", pid);
pr_info("----------------------------------------\n");
- ret = parasite_dump_thread_seized(parasite_ctl, id, tid, core);
+ ret = parasite_dump_thread_seized(parasite_ctl, item, id, tid, core);
if (ret) {
pr_err("Can't dump thread for pid %d\n", pid);
goto err;
diff --git a/criu/include/cgroup.h b/criu/include/cgroup.h
index 949266d40..6910c38a7 100644
--- a/criu/include/cgroup.h
+++ b/criu/include/cgroup.h
@@ -7,7 +7,7 @@
struct pstree_item;
struct parasite_dump_cgroup_args;
extern u32 root_cg_set;
-int dump_task_cgroup(struct pstree_item *, u32 *, struct parasite_dump_cgroup_args *args);
+int dump_task_cgroup(const struct pstree_item *, u32 *, struct parasite_dump_cgroup_args *args);
int dump_cgroups(void);
int prepare_task_cgroup(struct pstree_item *);
int prepare_cgroup(void);
diff --git a/criu/include/parasite-syscall.h b/criu/include/parasite-syscall.h
index 3887446d6..0f923f381 100644
--- a/criu/include/parasite-syscall.h
+++ b/criu/include/parasite-syscall.h
@@ -31,8 +31,8 @@ extern int parasite_dump_posix_timers_seized(struct proc_posix_timers_stat *proc
extern int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_dump_misc *misc);
extern int parasite_dump_creds(struct parasite_ctl *ctl, struct _CredsEntry *ce);
-extern int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, struct _CoreEntry *core);
-extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
+extern int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int pid, struct _CoreEntry *core);
+extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item, int id,
struct pid *tid, struct _CoreEntry *core);
extern int dump_thread_core(int pid, CoreEntry *core,
const struct parasite_dump_thread *dt);
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index fef902de9..b649552b8 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -102,7 +102,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
exit(1);
}
-static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c)
+static int alloc_groups_copy_creds(const struct pstree_item *item, CredsEntry *ce, struct parasite_dump_creds *c)
{
BUILD_BUG_ON(sizeof(ce->groups[0]) != sizeof(c->groups[0]));
BUILD_BUG_ON(sizeof(ce->cap_inh[0]) != sizeof(c->cap_inh[0]));
@@ -137,7 +137,8 @@ static int alloc_groups_copy_creds(CredsEntry *ce, struct parasite_dump_creds *c
return ce->groups ? 0 : -ENOMEM;
}
-int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEntry *core)
+int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, const struct pstree_item *item,
+ int pid, CoreEntry *core)
{
ThreadCoreEntry *tc = core->thread_core;
struct parasite_dump_thread *args;
@@ -153,7 +154,7 @@ int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn
if (ret < 0)
return ret;
- ret = alloc_groups_copy_creds(tc->creds, pc);
+ ret = alloc_groups_copy_creds(item, tc->creds, pc);
if (ret) {
pr_err("Can't copy creds for thread leader %d\n", pid);
return -1;
@@ -162,8 +163,8 @@ int parasite_dump_thread_leader_seized(struct parasite_ctl *ctl, int pid, CoreEn
return dump_thread_core(pid, core, args);
}
-int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
- struct pid *tid, CoreEntry *core)
+int parasite_dump_thread_seized(struct parasite_ctl *ctl, const struct pstree_item *item,
+ int id, struct pid *tid, CoreEntry *core)
{
struct parasite_dump_thread *args;
pid_t pid = tid->real;
@@ -193,7 +194,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, int id,
goto err_rth;
}
- ret = alloc_groups_copy_creds(creds, pc);
+ ret = alloc_groups_copy_creds(item, creds, pc);
if (ret) {
pr_err("Can't copy creds for thread %d\n", pid);
goto err_rth;
More information about the CRIU
mailing list