[Replicant] [libsamsung-ril] [PATCH 22/23] utils: eventfd_recv: report errors

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Thu Mar 4 12:42:49 UTC 2021

This enables to distinguish different kind of loop failures.

The loop handler comes directly from libsamsung-ipc device
drivers, which in turn wrap the vendor kernel interfaces.

Given that there is some possible variation between the way
that the .loop implementations behaves, it's a good idea to
add prints to understand better what is going on in case of

With the development of a new set of kernel drivers and
libsamsung-ipc device driver for Replicant 11, we had a
situation where that code was triggered.

Note that, at the time of writing, we are not (yet) aware
of any behavior difference with the different .loop
implementations, but it would be worth checking if they all
behave in the same way.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
 utils.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index 10b4529..cc2e9d9 100644
--- a/utils.c
+++ b/utils.c
@@ -21,6 +21,7 @@
 #define LOG_TAG "RIL"
 #include <ctype.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -229,8 +230,12 @@ int eventfd_recv(int fd, eventfd_t *event)
 	int rc;
 	rc = eventfd_read(fd, event);
-	if (rc < 0)
+	if (rc < 0) {
+		rc = errno;
+		RIL_LOGE("%s: eventfd_read error %d: %s", __func__,
+			 rc, strerror(rc));
 		return -1;
+	}
 	return 0;

More information about the Replicant mailing list