Eliminate use of INTERRUPTABLE_EXTENT on read and write system calls.
authorChris Hanson <org/chris-hanson/cph>
Sat, 27 Apr 1991 00:43:50 +0000 (00:43 +0000)
committerChris Hanson <org/chris-hanson/cph>
Sat, 27 Apr 1991 00:43:50 +0000 (00:43 +0000)
This doesn't work as the system call might finish and then check for
signals just before returning with a valid answer (and thereby losing
data).

This code should work OK for 4.3BSD, POSIX, and SYSV systems.
Unfortunately there's no good way to make it work for 4.2BSD -- which
probably means some hairy kludge will be needed to get ^G interrupts
to work on that system.  This will require identifying when we go into
an input wait on the console.

v7/src/microcode/gpio.c
v7/src/microcode/ux.c
v7/src/microcode/uxio.c
v7/src/microcode/version.h
v8/src/microcode/version.h

index 90872ad932cef40425e8d309cf3ef8e8f12b6423..cef114864655f42532181c50fb1cf06935bcd043 100644 (file)
@@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising,
 promotional, or sales literature without prior written consent from
 MIT in each case. */
 
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/gpio.c,v 1.8 1991/01/24 11:24:57 cph Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/gpio.c,v 1.9 1991/04/27 00:43:27 cph Exp $ */
 
 /* Scheme primitives for GPIO */
 
@@ -144,9 +144,7 @@ DEFINE_PRIMITIVE ("GPIO-READ-STRING!", Prim_gpio_read_string, 4, 4, 0)
 
   while (1)
   {
-    long scr;
-    INTERRUPTABLE_EXTENT
-      (scr, (read (gpio_channel, data, count)));
+    long scr = (read (gpio_channel, data, count));
     if (scr < 0)
     {
       UX_prim_check_errno (syscall_read);
@@ -172,9 +170,7 @@ DEFINE_PRIMITIVE ("GPIO-WRITE-STRING", Prim_gpio_write_string, 4, 4, 0)
 
   while (1)
   {
-    long scr;
-    INTERRUPTABLE_EXTENT
-      (scr, (write (gpio_channel, data, count)));
+    long scr = (write (gpio_channel, data, count));
     if (scr < 0)
     {
       UX_prim_check_errno (syscall_write);
index c1cfab49c7651c5664880d58afd8274ff650d8eb..7c9d5bc5fc2b25def32a60efc10437bc50e7a750 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.c,v 1.7 1991/03/01 00:55:53 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/ux.c,v 1.8 1991/04/27 00:43:33 cph Exp $
 
 Copyright (c) 1990-1 Massachusetts Institute of Technology
 
@@ -479,6 +479,10 @@ DEFUN (UX_sigismember, (set, signo), CONST sigset_t * set AND int signo)
 #define UX_sigvec sigvec
 #endif
 
+#ifndef SV_INTERRUPT
+#define SV_INTERRUPT 0
+#endif
+
 int
 DEFUN (UX_sigaction, (signo, act, oact),
        int signo AND
@@ -493,8 +497,7 @@ DEFUN (UX_sigaction, (signo, act, oact),
     {
       (vec -> sv_handler) = (act -> sa_handler);
       (vec -> sv_mask) = (act -> sa_mask);
-      /* Ignore SA_NOCLDSTOP since we won't use it. */
-      (vec -> sv_flags) = 0;
+      (vec -> sv_flags) = SV_INTERRUPT;
     }
   if ((UX_sigvec (signo, vec, ovec)) < 0)
     return (-1);
index d2adf578314cada361392fb5a0aed16064057288..928934a3769243480aaf75828a08f9afc0214bf0 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.13 1991/03/28 05:38:47 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.14 1991/04/27 00:43:40 cph Exp $
 
 Copyright (c) 1990-91 Massachusetts Institute of Technology
 
@@ -174,9 +174,7 @@ DEFUN (OS_channel_read, (channel, buffer, nbytes),
     return (0);
   while (1)
     {
-      long scr;
-      INTERRUPTABLE_EXTENT
-       (scr, (UX_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes)));
+      long scr = (UX_read ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
       if (scr < 0)
        {
 #ifdef ERRNO_NONBLOCK
@@ -206,9 +204,7 @@ DEFUN (OS_channel_write, (channel, buffer, nbytes),
     return (0);
   while (1)
     {
-      long scr;
-      INTERRUPTABLE_EXTENT
-       (scr, (UX_write ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes)));
+      long scr = (UX_write ((CHANNEL_DESCRIPTOR (channel)), buffer, nbytes));
       if (scr < 0)
        {
 #ifdef ERRNO_NONBLOCK
index d8a24fd899300c4edbebb07efcfa2b3232a2d63b..965bb8279bbee4091f9593f14d72f6eb6e73e81b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.75 1991/04/26 05:25:11 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.76 1991/04/27 00:43:50 cph Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     75
+#define SUBVERSION     76
 #endif
index 7fd46e5729567ae15784ba69f440297c8f68863a..27ef9ea4d8efe7ccd4ae02a5070797e10ae619ee 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.75 1991/04/26 05:25:11 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.76 1991/04/27 00:43:50 cph Exp $
 
 Copyright (c) 1988-91 Massachusetts Institute of Technology
 
@@ -46,5 +46,5 @@ MIT in each case. */
 #define VERSION                11
 #endif
 #ifndef SUBVERSION
-#define SUBVERSION     75
+#define SUBVERSION     76
 #endif