mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
rlimit: Allocate and free appropriate Core entry, v2
On Thu, Mar 13, 2014 at 04:20:37PM +0400, Pavel Emelyanov wrote: > > Would you rework this patch on top of my recent > "allocate Core in on xmalloc call" one? Attached. >From c2233d4fafce30c4e7214a1a7ab3677824a30d75 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov <gorcunov@openvz.org> Date: Thu, 13 Mar 2014 16:57:14 +0400 Subject: [PATCH] rlimit: Allocate and free appropriate Core entry Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
2341cd1f08
commit
d2e30bcce8
25
pstree.c
25
pstree.c
@@ -29,8 +29,14 @@ CoreEntry *core_entry_alloc(int th, int tsk)
|
||||
void *m;
|
||||
|
||||
sz = sizeof(CoreEntry);
|
||||
if (tsk)
|
||||
if (tsk) {
|
||||
sz += sizeof(TaskCoreEntry) + TASK_COMM_LEN;
|
||||
if (th) {
|
||||
sz += sizeof(TaskRlimitsEntry);
|
||||
sz += RLIM_NLIMITS * sizeof(RlimitEntry *);
|
||||
sz += RLIM_NLIMITS * sizeof(RlimitEntry);
|
||||
}
|
||||
}
|
||||
if (th)
|
||||
sz += sizeof(ThreadCoreEntry) + sizeof(ThreadSasEntry);
|
||||
|
||||
@@ -45,6 +51,23 @@ CoreEntry *core_entry_alloc(int th, int tsk)
|
||||
task_core_entry__init(core->tc);
|
||||
core->tc->comm = xptr_pull_s(&m, TASK_COMM_LEN);
|
||||
memzero(core->tc->comm, TASK_COMM_LEN);
|
||||
|
||||
if (th) {
|
||||
TaskRlimitsEntry *rls;
|
||||
int i;
|
||||
|
||||
rls = xptr_pull(&m, TaskRlimitsEntry);
|
||||
task_rlimits_entry__init(rls);
|
||||
core->rlimits = rls;
|
||||
|
||||
rls->n_rlimits = RLIM_NLIMITS;
|
||||
rls->rlimits = xptr_pull_s(&m, sizeof(RlimitEntry *) * RLIM_NLIMITS);
|
||||
|
||||
for (i = 0; i < RLIM_NLIMITS; i++) {
|
||||
rls->rlimits[i] = xptr_pull(&m, RlimitEntry);
|
||||
rlimit_entry__init(rls->rlimits[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (th) {
|
||||
|
Reference in New Issue
Block a user