From: benjamin@sipsolutions.net
To: linux-um@lists.infradead.org
Cc: Benjamin Berg <benjamin.berg@intel.com>
Subject: [PATCH 2/4] um: chan_user: catch EINTR when reading and writing
Date: Wed, 18 Oct 2023 14:36:41 +0200 [thread overview]
Message-ID: <20231018123643.1255813-2-benjamin@sipsolutions.net> (raw)
In-Reply-To: <20231018123643.1255813-1-benjamin@sipsolutions.net>
From: Benjamin Berg <benjamin.berg@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@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
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2023-10-18 12:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 12:36 [PATCH 1/4] um: irqs: process outstanding IRQs when unblocking signals benjamin
2023-10-18 12:36 ` benjamin [this message]
2023-10-18 12:36 ` [PATCH 3/4] um: chan_user: retry partial writes benjamin
2023-10-18 12:36 ` [PATCH 4/4] um: chan: use blocking IO for console output for time-travel benjamin
2023-10-20 9:15 ` [PATCH 1/4] um: irqs: process outstanding IRQs when unblocking signals Benjamin Beichler
2023-10-20 9:26 ` Anton Ivanov
2023-10-20 10:33 ` Benjamin Beichler
2023-10-20 9:59 ` Benjamin Berg
2023-10-20 10:38 ` Benjamin Beichler
2023-10-20 11:39 ` Johannes Berg
2023-10-20 12:06 ` Benjamin Beichler
2023-10-20 12:20 ` Johannes Berg
2023-10-20 12:23 ` Johannes Berg
2023-10-20 12:43 ` Benjamin Beichler
2023-10-20 12:58 ` Johannes Berg
2023-10-20 12:58 ` Benjamin Beichler
2023-10-20 13:39 ` Johannes Berg
2023-10-20 15:47 ` Benjamin Beichler
2023-10-20 15:51 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231018123643.1255813-2-benjamin@sipsolutions.net \
--to=benjamin@sipsolutions.net \
--cc=benjamin.berg@intel.com \
--cc=linux-um@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox