[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvz-criu
Subject:    [CRIU] [PATCH v2 06/14] files: Count inh_fd_max
From:       Kirill Tkhai <ktkhai () virtuozzo ! com>
Date:       2017-12-28 13:09:38
Message-ID: 151446657873.28132.16075991124016605234.stgit () localhost ! localdomain
[Download RAW message or body]

This patch counts maximum of inherited fds.
The value will be used in next patch.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/files.c         |    5 +++++
 criu/include/files.h |    2 ++
 2 files changed, 7 insertions(+)

diff --git a/criu/files.c b/criu/files.c
index 705fecf5f..d446a2393 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1503,6 +1503,8 @@ struct inherit_fd {
 	dev_t inh_rdev;
 };
 
+int inh_fd_max = -1;
+
 /*
  * Return 1 if inherit fd has been closed or reused, 0 otherwise.
  *
@@ -1599,6 +1601,9 @@ int inherit_fd_add(int fd, char *key)
 	if (inh == NULL)
 		return -1;
 
+	if (fd > inh_fd_max)
+		inh_fd_max = fd;
+
 	inh->inh_id = key;
 	inh->inh_fd = fd;
 	inh->inh_dev = sbuf.st_dev;
diff --git a/criu/include/files.h b/criu/include/files.h
index 661a803e1..bd4ab8470 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -92,6 +92,8 @@ struct fdinfo_list_entry {
 	u8			fake:1;
 };
 
+extern int inh_fd_max;
+
 /* reports whether fd_a takes prio over fd_b */
 static inline int fdinfo_rst_prio(struct fdinfo_list_entry *fd_a, struct fdinfo_list_entry *fd_b)
 {

_______________________________________________
CRIU mailing list
CRIU@openvz.org
https://lists.openvz.org/mailman/listinfo/criu
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic