2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

crtools: close all desriptors only for the root task

For all other tasks only unsed service descriptors will be closed.

This change allows to have file descriptors, which may be used for
restoring namespaces. All non-server descriptors must be closed before
restoring files.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2014-04-09 04:13:29 +04:00
committed by Pavel Emelyanov
parent bb5bba53b8
commit d36e07aabe
3 changed files with 28 additions and 9 deletions

12
util.c
View File

@@ -341,6 +341,18 @@ int close_service_fd(enum sfd_type type)
return 0;
}
/* Close all unused service descriptors on a depth of nr. */
void close_old_servie_fd(int nr)
{
int level, i;
BUG_ON(service_fd_id != 0);
for (level = 1; level < nr; level++) {
for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++) {
close(__get_service_fd(i, level));
}
}
}
int clone_service_fd(int id)
{
int ret = -1, i;