diff packages/hal/i386/linux/current/src/hal_diag.c @ 44:41bd4f3a90de ecos-sw-1999-10-08

Merge from eCos master repository on 1999-10-08-07:47:04-BST
author jlarmour
date Fri, 08 Oct 1999 13:16:25 +0000
parents 443894e2e912
children 7a6ac9edc838
line wrap: on
line diff
--- a/packages/hal/i386/linux/current/src/hal_diag.c
+++ b/packages/hal/i386/linux/current/src/hal_diag.c
@@ -69,9 +69,21 @@ void hal_diag_write_char(char __c)
     }
 }
 
+// Hmm... we need the definition of EINTR, which normally lives in
+// <asm/errno.h> on linux. But we can't get at that here, so we just
+// hard-code it. The burden of binary compatibility means x86 linux will
+// never change it.
+#define x86_linux_EINTR 4
+
 void hal_diag_read_char(char *c)
 {
-    cyg_hal_sys_read(0, c, 1);
+    int rc;
+
+    // The read syscall will get woken up by the itimer alarm, but we don't
+    // want to stop reading if that's the case
+    do {
+        rc = cyg_hal_sys_read(0, c, 1);
+    } while (-x86_linux_EINTR == rc);
 }
 
 //-----------------------------------------------------------------------------