From e706a92a4874d32b423e595a8051e3867ce84246 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 27 Apr 1991 00:43:50 +0000 Subject: [PATCH] Eliminate use of INTERRUPTABLE_EXTENT on read and write system calls. 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 | 10 +++------- v7/src/microcode/ux.c | 9 ++++++--- v7/src/microcode/uxio.c | 10 +++------- v7/src/microcode/version.h | 4 ++-- v8/src/microcode/version.h | 4 ++-- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/v7/src/microcode/gpio.c b/v7/src/microcode/gpio.c index 90872ad93..cef114864 100644 --- a/v7/src/microcode/gpio.c +++ b/v7/src/microcode/gpio.c @@ -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); diff --git a/v7/src/microcode/ux.c b/v7/src/microcode/ux.c index c1cfab49c..7c9d5bc5f 100644 --- a/v7/src/microcode/ux.c +++ b/v7/src/microcode/ux.c @@ -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); diff --git a/v7/src/microcode/uxio.c b/v7/src/microcode/uxio.c index d2adf5783..928934a37 100644 --- a/v7/src/microcode/uxio.c +++ b/v7/src/microcode/uxio.c @@ -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 diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index d8a24fd89..965bb8279 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -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 diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index 7fd46e572..27ef9ea4d 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -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 -- 2.25.1