[CRIU] [PATCH v4 11/19] files: Rename service_fd_rlim_cur to service_fd_base_cur
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Jan 10 17:02:09 MSK 2018
Next patches will make service fds numbers not connected
not rlimit. Change the name to better fit its goal.
Also, leave service_fd_rlim_cur variable to have cached
access to rlimit value.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
v2: More comments
---
criu/include/util.h | 2 ++
criu/util.c | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/criu/include/util.h b/criu/include/util.h
index 0ebdb4b80..8a1718c1e 100644
--- a/criu/include/util.h
+++ b/criu/include/util.h
@@ -37,6 +37,8 @@
struct vma_area;
struct list_head;
+extern int service_fd_rlim_cur;
+
extern void pr_vma(unsigned int loglevel, const struct vma_area *vma_area);
#define pr_info_vma(vma_area) pr_vma(LOG_INFO, vma_area)
diff --git a/criu/util.c b/criu/util.c
index c3665f10b..3a870a2b1 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -434,7 +434,11 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...)
return openat(dirfd, path, flags);
}
-static int service_fd_rlim_cur;
+/* Max potentially possible fd to be open by criu process */
+int service_fd_rlim_cur;
+/* Base of current process service fds set */
+static int service_fd_base;
+/* Id of current process in shared fdt */
static int service_fd_id = 0;
int init_service_fd(void)
@@ -452,14 +456,15 @@ int init_service_fd(void)
}
service_fd_rlim_cur = (int)rlimit.rlim_cur;
- BUG_ON(service_fd_rlim_cur < SERVICE_FD_MAX);
+ service_fd_base = service_fd_rlim_cur;
+ BUG_ON(service_fd_base < SERVICE_FD_MAX);
return 0;
}
static int __get_service_fd(enum sfd_type type, int service_fd_id)
{
- return service_fd_rlim_cur - type - SERVICE_FD_MAX * service_fd_id;
+ return service_fd_base - type - SERVICE_FD_MAX * service_fd_id;
}
int service_fd_min_fd(struct pstree_item *item)
More information about the CRIU
mailing list