[lxc-devel] [lxd/master] forkproxy: Retry epoll on EINTR

evhan on Github lxc-bot at linuxcontainers.org
Tue Apr 16 01:57:53 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 743 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190415/a1012b23/attachment.bin>
-------------- next part --------------
From 6b00e2a8696bbb3611a1fb2190a86c311533e49a Mon Sep 17 00:00:00 2001
From: Evan Hanson <evanh at catalyst.net.nz>
Date: Tue, 16 Apr 2019 13:25:29 +1200
Subject: [PATCH] forkproxy: Retry epoll on EINTR

Signed-off-by: Evan Hanson <evanh at catalyst.net.nz>
---
 lxd/main_forkproxy.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lxd/main_forkproxy.go b/lxd/main_forkproxy.go
index 328be0c53a..fb2213a548 100644
--- a/lxd/main_forkproxy.go
+++ b/lxd/main_forkproxy.go
@@ -73,11 +73,11 @@ again:
 	return 0;
 }
 
-ssize_t lxc_read_nointr(int fd, void* buf, size_t count)
+int lxc_epoll_wait_nointr(int epfd, struct epoll_event* events, int maxevents, int timeout)
 {
-	ssize_t ret;
+	int ret;
 again:
-	ret = read(fd, buf, count);
+	ret = epoll_wait(epfd, events, maxevents, timeout);
 	if (ret < 0 && errno == EINTR)
 		goto again;
 	return ret;
@@ -670,9 +670,9 @@ func (c *cmdForkproxy) Run(cmd *cobra.Command, args []string) error {
 	for {
 		var events [10]C.struct_epoll_event
 
-		nfds := C.epoll_wait(epFd, &events[0], 10, -1)
+		nfds := C.lxc_epoll_wait_nointr(epFd, &events[0], 10, -1)
 		if nfds < 0 {
-			fmt.Printf("Failed to wait on epoll instance")
+			fmt.Printf("Failed to wait on epoll instance\n")
 			break
 		}
 


More information about the lxc-devel mailing list