[CRIU] [PATCH cr] files: rework a function for closing all
descriptors
Cyrill Gorcunov
gorcunov at openvz.org
Fri Sep 28 11:34:53 EDT 2012
On Fri, Sep 28, 2012 at 10:34:58PM +0400, Andrey Vagin wrote:
> It reads /proc/PID/fd and close all descriptors except service fds.
>
> +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_one_of_service_fds(int fd)
bool is_service_fd_any(int fd) sounds better?
since we have is_service_fd which match for single entity.
> +{
> + 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)
Cyrill
More information about the CRIU
mailing list