mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
freezer: don't catch kernel threads
OpenVZ creates per-container kernel threads and they live in container's cgroups. CRIU should skip these threads, it's impossiable to get any state of them. Signed-off-by: Andrew Vagin <avagin@virtuozzo.org> Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
e36dbef13d
commit
6a400cd73a
1 changed files with 9 additions and 0 deletions
9
seize.c
9
seize.c
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
|
@ -141,6 +142,14 @@ static int freeze_processes(void)
|
|||
continue;
|
||||
|
||||
if (seize_catch_task(pid) && state == frozen) {
|
||||
char buf[] = "/proc/XXXXXXXXXX/exe";
|
||||
struct stat st;
|
||||
|
||||
/* skip kernel threads */
|
||||
snprintf(buf, sizeof(buf), "/proc/%d/exe", pid);
|
||||
if (stat(buf, &st) == -1 && errno == ENOENT)
|
||||
continue;
|
||||
|
||||
/* fails when meets a zombie */
|
||||
fclose(f);
|
||||
goto err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue