[PATCH 2/4] um: chan_user: catch EINTR when reading and writing
benjamin at sipsolutions.net
benjamin at sipsolutions.net
Wed Oct 18 05:36:41 PDT 2023
From: Benjamin Berg <benjamin.berg at intel.com>
If the read/write function returns an error then we expect to see an
event/IRQ later on. However, this will only happen after an EAGAIN as we
are using edge based event triggering.
As such, EINTR needs to be caught should it happen.
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
arch/um/drivers/chan_user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 25727ed648b7..29c68820522a 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -23,7 +23,7 @@ int generic_read(int fd, char *c_out, void *unused)
{
int n;
- n = read(fd, c_out, sizeof(*c_out));
+ CATCH_EINTR(n = read(fd, c_out, sizeof(*c_out)));
if (n > 0)
return n;
else if (n == 0)
@@ -39,7 +39,7 @@ int generic_write(int fd, const char *buf, int n, void *unused)
{
int err;
- err = write(fd, buf, n);
+ CATCH_EINTR(err = write(fd, buf, n));
if (err > 0)
return err;
else if (errno == EAGAIN)
--
2.41.0
More information about the linux-um
mailing list