qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Missing system calls retries in case of EINTR
@ 2007-06-26  0:14 Yigael Fleishman
  2007-07-06 18:57 ` Rob Landley
  0 siblings, 1 reply; 5+ messages in thread
From: Yigael Fleishman @ 2007-06-26  0:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: frederic.roussel

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

Running qemu on a Ubuntu Feisty host I've encountered an occasional
failure-to-launch problem.
I've used the "-serial /dev/ttyS0" at the command line, and qemu would often
exit printing "could not open serial device".
Looking in the srcs I've noticed that  qemu_chr_open_tty does not retry the
'open' syscall if it fails and errno=EINTR.
I've added a retry for such case and it seems to solve that specific problem
(see the following patch).
Furthermore, I've noticed that all open, read and some write calls in
vl.care not retried in such cases.
It seems to me retries should be implemented in those cases, however I might
still be missing something here.

--- /tmp/p4diff/vl.c#1.32670    2007-06-25 17:04:53.000000000 -0700
+++ vl.c        2007-06-25 17:04:29.000000000 -0700
@@ -1786,9 +1786,19 @@
     CharDriverState *chr;
     int fd;

-    fd = open(filename, O_RDWR | O_NONBLOCK);
-    if (fd < 0)
-        return NULL;
+    /* The following code wraps the 'open' syscall and retries it in case
it is interrupted. */
+    while (1)
+    {
+       fd = open(filename, O_RDWR | O_NONBLOCK );
+
+       if (fd < 0)
+       {
+           if (errno != EINTR)
+               return NULL;
+       }
+       else
+           break;
+    }
     fcntl(fd, F_SETFL, O_NONBLOCK);
     tty_serial_init(fd, 115200, 'N', 8, 1);
     chr = qemu_chr_open_fd(fd, fd);

[-- Attachment #2: Type: text/html, Size: 2145 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-11 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26  0:14 [Qemu-devel] Missing system calls retries in case of EINTR Yigael Fleishman
2007-07-06 18:57 ` Rob Landley
2007-07-11  0:57   ` Yigael Fleishman
2007-07-11 17:04     ` Rob Landley
2007-07-11 17:57       ` Yigael Fleishman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).