mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
files: rework a function for closing all descriptors (v2)
It reads /proc/PID/fd and close all descriptors except service fds. v2: s/is_one_of_service_fds/is_any_service_fd Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
edf8ec3fe3
commit
d33d2290bd
13
util.c
13
util.c
@@ -281,10 +281,21 @@ int init_service_fd(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __get_service_fd(enum sfd_type type)
|
||||
{
|
||||
return service_fd_rlim_cur - type;
|
||||
}
|
||||
|
||||
int get_service_fd(enum sfd_type type)
|
||||
{
|
||||
BUG_ON((int)type <= SERVICE_FD_MIN || (int)type >= SERVICE_FD_MAX);
|
||||
return service_fd_rlim_cur - type;
|
||||
return __get_service_fd(type);
|
||||
}
|
||||
|
||||
bool is_any_service_fd(int fd)
|
||||
{
|
||||
return fd > __get_service_fd(SERVICE_FD_MAX) &&
|
||||
fd < __get_service_fd(SERVICE_FD_MIN);
|
||||
}
|
||||
|
||||
bool is_service_fd(int fd, enum sfd_type type)
|
||||
|
Reference in New Issue
Block a user