[CRIU] [PATCH 3/7] rlimit: Allocate and free appropriate Core entry, v2
Pavel Emelyanov
xemul at parallels.com
Fri Mar 14 02:45:25 PDT 2014
On 03/13/2014 05:17 PM, Cyrill Gorcunov wrote:
> 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.
>
> @@ -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 *task_rlimits;
> + size_t i;
> +
> + task_rlimits = xptr_pull(&m, TaskRlimitsEntry);
> + task_rlimits_entry__init(task_rlimits);
> + core->task_rlimits = task_rlimits;
> +
> + task_rlimits->n_rlimits = RLIM_NLIMITS;
> + task_rlimits->rlimits = xptr_pull_s(&m, sizeof(RlimitEntry *) * RLIM_NLIMITS);
> +
> + for (i = 0; i < RLIM_NLIMITS; i++) {
> + task_rlimits->rlimits[i] = xptr_pull(&m, RlimitEntry);
> + rlimit_entry__init(task_rlimits->rlimits[i]);
> + }
> + }
> }
>
> if (th) {
rlimits are per task, why allocating them per thread?
More information about the CRIU
mailing list