mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 16:25:31 +00:00
dump: Read aux vector in one pass
No need to read it in cycle. Repored-by: Pavel Emelyanov <xemul@parallels.com> 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
c76ac46c71
commit
459828b6be
26
cr-dump.c
26
cr-dump.c
@@ -375,9 +375,9 @@ static int check_sysvipc_map_dump(pid_t pid, VmaEntry *vma)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_task_auxv(pid_t pid, MmEntry *mm, size_t *size)
|
static int get_task_auxv(pid_t pid, MmEntry *mm)
|
||||||
{
|
{
|
||||||
int fd, ret, i;
|
int fd, ret;
|
||||||
|
|
||||||
pr_info("Obtaining task auvx ...\n");
|
pr_info("Obtaining task auvx ...\n");
|
||||||
|
|
||||||
@@ -385,20 +385,14 @@ static int get_task_auxv(pid_t pid, MmEntry *mm, size_t *size)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < AT_VECTOR_SIZE; i++) {
|
ret = read(fd, mm->mm_saved_auxv, pb_repeated_size(mm, mm_saved_auxv));
|
||||||
ret = read(fd, &mm->mm_saved_auxv[i],
|
if (ret < 0) {
|
||||||
sizeof(auxv_t));
|
ret = -1;
|
||||||
if (ret == 0)
|
pr_perror("Error reading %d's auxv", pid);
|
||||||
break;
|
goto err;
|
||||||
else if (ret != sizeof(auxv_t)) {
|
} else
|
||||||
ret = -1;
|
mm->n_mm_saved_auxv = ret / sizeof(mm->mm_saved_auxv[0]);
|
||||||
pr_perror("Error reading %d's auxv[%d]",
|
|
||||||
pid, i);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*size = i;
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err:
|
err:
|
||||||
close_safe(&fd);
|
close_safe(&fd);
|
||||||
@@ -466,7 +460,7 @@ static int dump_task_mm(pid_t pid, const struct proc_pid_stat *stat,
|
|||||||
if (!mme.mm_saved_auxv)
|
if (!mme.mm_saved_auxv)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (get_task_auxv(pid, &mme, &mme.n_mm_saved_auxv))
|
if (get_task_auxv(pid, &mme))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (dump_task_exe_link(pid, &mme))
|
if (dump_task_exe_link(pid, &mme))
|
||||||
|
Reference in New Issue
Block a user