Commit e3538116 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Andrei Vagin

restore: Don't parse /proc/pid/threads for single-threaded tasks

We do this to get real pids of the threads, but sometimes
we just know that value.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent f17b60ef
......@@ -1542,8 +1542,12 @@ static int attach_to_tasks(bool root_seized)
if (!task_alive(item))
continue;
if (parse_threads(item->pid->real, &item->threads, &item->nr_threads))
return -1;
if (item->nr_threads == 1) {
item->threads[0].real = item->pid->real;
} else {
if (parse_threads(item->pid->real, &item->threads, &item->nr_threads))
return -1;
}
for (i = 0; i < item->nr_threads; i++) {
pid_t pid = item->threads[i].real;
......@@ -1595,8 +1599,12 @@ static int catch_tasks(bool root_seized, enum trace_flags *flag)
if (!task_alive(item))
continue;
if (parse_threads(item->pid->real, &item->threads, &item->nr_threads))
return -1;
if (item->nr_threads == 1) {
item->threads[0].real = item->pid->real;
} else {
if (parse_threads(item->pid->real, &item->threads, &item->nr_threads))
return -1;
}
for (i = 0; i < item->nr_threads; i++) {
pid_t pid = item->threads[i].real;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment