[CRIU] [RFC PATCH v2 19/23] util: introduce epoll_del_rfd

Mike Rapoport rppt at linux.vnet.ibm.com
Mon Feb 6 03:44:12 PST 2017


Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/include/util.h |  1 +
 criu/util.c         | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/criu/include/util.h b/criu/include/util.h
index e16707a..d1332ae 100644
--- a/criu/include/util.h
+++ b/criu/include/util.h
@@ -302,6 +302,7 @@ struct epoll_rfd {
 };
 
 extern int epoll_add_rfd(int epfd, struct epoll_rfd *);
+extern int epoll_del_rfd(int epfd, struct epoll_rfd *rfd);
 extern int epoll_run_rfds(int epfd, struct epoll_event *evs, int nr_fds, int tmo);
 extern int epoll_prepare(int nr_events, struct epoll_event **evs);
 
diff --git a/criu/util.c b/criu/util.c
index ca61a1c..cb9fe6f 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1229,6 +1229,16 @@ int epoll_add_rfd(int epfd, struct epoll_rfd *rfd)
 	return 0;
 }
 
+int epoll_del_rfd(int epfd, struct epoll_rfd *rfd)
+{
+	if (epoll_ctl(epfd, EPOLL_CTL_DEL, rfd->fd, NULL) == -1) {
+		pr_perror("epoll_ctl failed");
+		return -1;
+	}
+
+	return 0;
+}
+
 int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout)
 {
 	int ret, i, nr_events;
-- 
1.9.1



More information about the CRIU mailing list