Skip to contentSkip to conversation

eal: handle signal on eventfd

PATCH Applied Stephen Hemminger 2 participants 2 messages Jul 15, 2015 – Jul 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: handle signal on eventfd

The read for events in the interrupt thread may get interrupted by signals from application. Avoid generating stray log message.

---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +4 -2
index b5f369e..61e7c85 100644
@@ -720,12 +720,14 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 		 * for epoll_wait.
 		 */
 		bytes_read = read(events[n].data.fd, &buf, bytes_read);
+		if (bytes_read < 0) {
+			if (errno == EINTR || errno == EWOULDBLOCK)
+				continue;
 
-		if (bytes_read < 0)
 			RTE_LOG(ERR, EAL, "Error reading from file "
 				"descriptor %d: %s\n", events[n].data.fd,
 							strerror(errno));
-		else if (bytes_read == 0)
+		} else if (bytes_read == 0)
 			RTE_LOG(ERR, EAL, "Read nothing from file "
 				"descriptor %d\n", events[n].data.fd);
 
Signature · 1 line
2.1.4