[CRIU] [PATCH 05/12] files: Rename service_fd_rlim_cur to service_fd_base_cur
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Dec 26 18:46:29 MSK 2017
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>
---
criu/include/util.h | 2 ++
criu/util.c | 8 +++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/criu/include/util.h b/criu/include/util.h
index c40b0c6f9..722afb77a 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 386c755a6..8f290dd4e 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -434,7 +434,8 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...)
return openat(dirfd, path, flags);
}
-static int service_fd_rlim_cur;
+int service_fd_rlim_cur;
+static int service_fd_base;
static int service_fd_id = 0;
int init_service_fd(void)
@@ -452,14 +453,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