sending of SIGHUP to subprocesses.
* Bug fixes for channel registering and selection.
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osproc.h,v 1.4 1991/03/11 23:42:38 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osproc.h,v 1.5 1991/03/14 04:22:35 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
extern void EXFUN (OS_process_stop, (Tprocess process));
extern void EXFUN (OS_process_interrupt, (Tprocess process));
extern void EXFUN (OS_process_quit, (Tprocess process));
+extern void EXFUN (OS_process_hangup, (Tprocess process));
extern void EXFUN (OS_process_continue_background, (Tprocess process));
extern void EXFUN (OS_process_continue_foreground, (Tprocess process));
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osterm.h,v 1.6 1991/03/08 01:41:34 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/osterm.h,v 1.7 1991/03/14 04:22:41 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
extern void EXFUN (OS_pty_master_continue, (Tchannel channel));
extern void EXFUN (OS_pty_master_interrupt, (Tchannel channel));
extern void EXFUN (OS_pty_master_quit, (Tchannel channel));
+extern void EXFUN (OS_pty_master_hangup, (Tchannel channel));
#endif /* SCM_OSTERM_H */
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosio.c,v 1.5 1991/03/11 23:42:45 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosio.c,v 1.6 1991/03/14 04:22:45 cph Exp $
Copyright (c) 1987-91 Massachusetts Institute of Technology
DEFINE_PRIMITIVE ("CHANNEL-SELECT-THEN-READ", Prim_channel_select_then_read, 4, 4,
"Like CHANNEL-READ, but also watches registered input channels.\n\
If there is no input on CHANNEL, but there is input on some other registered\n\
-channel, this procedure returns #T.")
+channel or some subprocess status changes, this procedure returns #T.")
{
PRIMITIVE_HEADER (4);
CHECK_ARG (2, STRING_P);
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosproc.c,v 1.7 1991/03/11 23:42:52 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosproc.c,v 1.8 1991/03/14 04:22:50 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
"Sends the quit signal to process PROCESS-NUMBER (unix SIGQUIT).")
PROCESS_SIGNALLING_PRIMITIVE (OS_process_quit)
+DEFINE_PRIMITIVE ("PROCESS-HANGUP", Prim_process_hangup, 1, 1,
+ "Sends the hangup signal to process PROCESS-NUMBER (unix SIGHUP).")
+ PROCESS_SIGNALLING_PRIMITIVE (OS_process_hangup)
+
DEFINE_PRIMITIVE ("PROCESS-STOP", Prim_process_stop, 1, 1,
"Stops process PROCESS-NUMBER (unix SIGTSTP).")
PROCESS_SIGNALLING_PRIMITIVE (OS_process_stop)
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosterm.c,v 1.8 1991/03/08 01:41:38 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prosterm.c,v 1.9 1991/03/14 04:22:54 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
return (channel);
}
+static Tchannel
+DEFUN (arg_pty_master, (arg), unsigned int arg)
+{
+ Tchannel channel = (arg_channel (1));
+ if ((OS_channel_type (channel)) != channel_type_pty_master)
+ error_bad_range_arg (1);
+ return (channel);
+}
+
DEFINE_PRIMITIVE ("TERMINAL-GET-ISPEED", Prim_terminal_get_ispeed, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
}
}
-DEFINE_PRIMITIVE ("OS-JOB-CONTROL?", Prim_os_job_control_p, 0, 0, 0)
-{
- PRIMITIVE_HEADER (0);
- PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (OS_job_control_p ()));
-}
-\f
DEFINE_PRIMITIVE ("TERMINAL-GET-STATE", Prim_terminal_get_state, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
}
PRIMITIVE_RETURN (UNSPECIFIC);
}
-
+\f
DEFINE_PRIMITIVE ("TERMINAL-COOKED-OUTPUT?", Prim_terminal_cooked_output_p, 1, 1,
"Return #F iff TERMINAL is not in cooked output mode.")
{
OS_terminal_cooked_output (arg_terminal (1));
PRIMITIVE_RETURN (UNSPECIFIC);
}
-\f
+
DEFINE_PRIMITIVE ("TERMINAL-BUFFERED?", Prim_terminal_buffered_p, 1, 1,
"Return #F iff TERMINAL is not in buffered mode.")
{
OS_terminal_drain_output (arg_terminal (1));
PRIMITIVE_RETURN (UNSPECIFIC);
}
+
+DEFINE_PRIMITIVE ("OS-JOB-CONTROL?", Prim_os_job_control_p, 0, 0, 0)
+{
+ PRIMITIVE_HEADER (0);
+ PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT (OS_job_control_p ()));
+}
\f
DEFINE_PRIMITIVE ("HAVE-PTYS?", Prim_have_ptys_p, 0, 0, 0)
{
}
}
-static Tchannel
-DEFUN (arg_pty_master, (arg), unsigned int arg)
-{
- Tchannel channel = (arg_channel (1));
- if ((OS_channel_type (channel)) != channel_type_pty_master)
- error_bad_range_arg (1);
- return (channel);
-}
-
DEFINE_PRIMITIVE ("PTY-MASTER-SEND-SIGNAL", Prim_pty_master_send_signal, 2, 2,
"Send a signal to PTY-MASTER; second arg says which one.")
{
OS_pty_master_quit (arg_pty_master (1));
PRIMITIVE_RETURN (UNSPECIFIC);
}
+
+DEFINE_PRIMITIVE ("PTY-MASTER-HANGUP", Prim_pty_master_hangup, 1, 1, 0)
+{
+ PRIMITIVE_HEADER (1);
+ OS_pty_master_hangup (arg_pty_master (1));
+ PRIMITIVE_RETURN (UNSPECIFIC);
+}
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.41 1991/02/26 21:33:51 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/unxutl/Attic/ymkfile,v 1.42 1991/03/14 04:23:26 cph Exp $
Copyright (c) 1989-91 Massachusetts Institute of Technology
unexec.c unexhp9k800.c getpagesize.h
x11base.o x11graph.o x11term.o starbasex.o : scheme.touch prims.h x11.h
-x11base.o : ux.h
+x11base.o : ux.h osio.h uxselect.h
starbase.o : scheme.touch prims.h
Sgraph.o Sgraph_xt.o SgX.o : scheme.touch prims.h Sgraph.h
uxenv.o : osenv.h
uxfile.o : osfile.h osio.h uxio.h
uxfs.o : osfs.h
-uxio.o : osio.h uxio.h
+uxio.o : osio.h uxio.h uxselect.h
uxproc.o : osproc.h uxproc.h osio.h uxio.h osterm.h
uxsig.o : ossig.h osctty.h ostty.h uxtrap.h uxutil.h critsec.h
uxsock.o : uxsock.h osio.h uxio.h
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.10 1991/03/11 23:43:02 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxio.c,v 1.11 1991/03/14 04:22:59 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
#include "ux.h"
#include "uxio.h"
+#include "uxselect.h"
\f
size_t OS_channel_table_size;
struct channel * channel_table;
{
if (! (CHANNEL_INTERNAL (channel)))
{
- OS_channel_unregister (channel);
+ if (CHANNEL_REGISTERED (channel))
+ OS_channel_unregister (channel);
STD_VOID_SYSTEM_CALL
(syscall_close, (UX_close (CHANNEL_DESCRIPTOR (channel))));
MARK_CHANNEL_CLOSED (channel);
{
if (! (CHANNEL_INTERNAL (channel)))
{
- OS_channel_unregister (channel);
+ if (CHANNEL_REGISTERED (channel))
+ OS_channel_unregister (channel);
UX_close (CHANNEL_DESCRIPTOR (channel));
MARK_CHANNEL_CLOSED (channel);
}
(CHANNEL_REGISTERED (channel)) = 0;
}
}
-
-int
+\f
+enum select_input
DEFUN (UX_select_input, (fd, blockp), int fd AND int blockp)
{
#ifdef HAVE_SELECT
+ extern int EXFUN (UX_process_any_status_change, (void));
+ int status_change_p;
int nfds;
SELECT_TYPE readable = input_descriptors;
FD_SET (fd, (&readable));
- STD_UINT_SYSTEM_CALL
- (syscall_select,
- nfds,
- (select (FD_SETSIZE, (&readable), 0, 0, (blockp ? 0 : (&zero_timeout)))));
- return ((nfds > 0) && (! (FD_ISSET (fd, (&readable)))));
+ while (1)
+ {
+ status_change_p = 0;
+ INTERRUPTABLE_EXTENT
+ (nfds,
+ ((status_change_p = (UX_process_any_status_change ()))
+ ? ((errno = EINTR), (-1))
+ : (select (FD_SETSIZE, (&readable), 0, 0,
+ (blockp ? 0 : (&zero_timeout))))));
+ if (nfds > 0)
+ return
+ ((FD_ISSET (fd, (&readable)))
+ ? select_input_argument
+ : select_input_other);
+ else if (nfds == 0)
+ {
+ if (!blockp)
+ return (select_input_none);
+ }
+ else if (errno != EINTR)
+ error_system_call (errno, syscall_select);
+ else if (status_change_p)
+ return (select_input_process_status);
+ deliver_pending_interrupts ();
+ }
#else
- return (0);
+ return (select_input_argument);
#endif
}
size_t nbytes)
{
#ifdef HAVE_SELECT
- if ((OS_channels_registered > ((CHANNEL_REGISTERED (channel)) ? 1 : 0))
- && (UX_select_input ((CHANNEL_DESCRIPTOR (channel)),
- (CHANNEL_NONBLOCKING (channel)))))
- return (-2);
+ if (OS_channels_registered > ((CHANNEL_REGISTERED (channel)) ? 1 : 0))
+ switch (UX_select_input ((CHANNEL_DESCRIPTOR (channel)),
+ (! (CHANNEL_NONBLOCKING (channel)))))
+ {
+ case select_input_none:
+ return (-1);
+ case select_input_other:
+ case select_input_process_status:
+ return (-2);
+ }
#endif
return (OS_channel_read (channel, buffer, nbytes));
}
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxproc.c,v 1.9 1991/03/11 23:43:12 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxproc.c,v 1.10 1991/03/14 04:23:03 cph Exp $
Copyright (c) 1990-91 Massachusetts Institute of Technology
kill_child:
_exit (1);
}
-\f
+
#define DEFUN_PROCESS_ACCESSOR(name, result_type, accessor) \
result_type \
DEFUN (name, (process), Tprocess process) \
DEFUN_PROCESS_ACCESSOR (OS_process_reason, unsigned short, PROCESS_REASON)
DEFUN_PROCESS_ACCESSOR
(OS_process_jc_status, enum process_jc_status, PROCESS_JC_STATUS)
-
+\f
int
DEFUN (OS_process_valid_p, (process), Tprocess process)
{
return (result);
}
}
+
+int
+DEFUN_VOID (UX_process_any_status_change)
+{
+ return (process_tick != sync_tick);
+}
\f
void
DEFUN (OS_process_send_signal, (process, sig), Tprocess process AND int sig)
OS_process_send_signal (process, SIGQUIT);
}
+void
+DEFUN (OS_process_hangup, (process), Tprocess process)
+{
+ OS_process_send_signal (process, SIGHUP);
+}
+
void
DEFUN (OS_process_continue_background, (process), Tprocess process)
{
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxterm.c,v 1.12 1991/03/08 01:41:42 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxterm.c,v 1.13 1991/03/14 04:23:08 cph Exp $
Copyright (c) 1990-1 Massachusetts Institute of Technology
error_external_return ();
return (0);
}
-
+\f
void
DEFUN (OS_pty_master_send_signal, (channel, sig), Tchannel channel AND int sig)
{
{
OS_pty_master_send_signal (channel, SIGQUIT);
}
+
+void
+DEFUN (OS_pty_master_hangup, (channel), Tchannel channel)
+{
+ OS_pty_master_send_signal (channel, SIGHUP);
+}
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.67 1991/03/11 23:43:21 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.68 1991/03/14 04:23:15 cph Exp $
Copyright (c) 1988-91 Massachusetts Institute of Technology
#define VERSION 11
#endif
#ifndef SUBVERSION
-#define SUBVERSION 67
+#define SUBVERSION 68
#endif
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.16 1991/03/11 23:43:28 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/x11base.c,v 1.17 1991/03/14 04:23:20 cph Exp $
Copyright (c) 1989-91 Massachusetts Institute of Technology
#include "scheme.h"
#include "prims.h"
#include "ux.h"
+#include "osio.h"
+#include "uxselect.h"
#include "x11.h"
int x_debug = 0;
entry that reads events -- or else that all other event readers
cooperate with this strategy. */
-extern unsigned int OS_channels_registered;
-extern int EXFUN (UX_select_input, (int fd, int blockp));
+/* The time_limit argument is currently ignored, because Edwin doesn't
+ use it. */
static SCHEME_OBJECT
DEFUN (xd_process_events, (xd, time_limit_p, time_limit),
int time_limit_p AND
unsigned long time_limit)
{
- unsigned int events_queued = 0;
Display * display = (XD_DISPLAY (xd));
+ int do_select = (OS_channels_registered > 0);
+ unsigned int events_queued;
if (XD_CACHED_EVENT_P (xd))
- goto restart;
+ {
+ events_queued = (XEventsQueued (display, QueuedAlready));
+ goto restart;
+ }
+ events_queued =
+ (do_select ? (XEventsQueued (display, QueuedAlready))
+ : time_limit_p ? (XEventsQueued (display, QueuedAfterReading))
+ : 0);
while (1)
{
- extern unsigned long EXFUN (OS_real_time_clock, (void));
XEvent event;
- if (time_limit_p || (OS_channels_registered > 0))
- {
- if (events_queued > 0)
- events_queued -= 1;
- else
- while (1)
- {
- events_queued = (XEventsQueued (display, QueuedAfterReading));
- if (events_queued > 0)
- {
- events_queued -= 1;
- break;
- }
- if (time_limit_p && ((OS_real_time_clock ()) >= time_limit))
- return (SHARP_F);
- if (UX_select_input ((ConnectionNumber (display)),
- (!time_limit_p)))
- /* No input is available from the display, but some
- other registered input channel has input. Return a
- special value immediately so that input can be
- processed. */
- return (SHARP_T);
- }
- }
+ if (events_queued > 0)
+ events_queued -= 1;
+ else if (do_select)
+ switch (UX_select_input ((ConnectionNumber (display)),
+ (!time_limit_p)))
+ {
+ case select_input_none:
+ return (SHARP_F);
+ case select_input_other:
+ case select_input_process_status:
+ return (SHARP_T);
+ case select_input_argument:
+ events_queued = (XEventsQueued (display, QueuedAfterReading));
+ continue;
+ }
+ else if (time_limit_p)
+ return (SHARP_F);
XNextEvent (display, (&event));
if ((event . type) == KeymapNotify)
continue;
/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.67 1991/03/11 23:43:21 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.68 1991/03/14 04:23:15 cph Exp $
Copyright (c) 1988-91 Massachusetts Institute of Technology
#define VERSION 11
#endif
#ifndef SUBVERSION
-#define SUBVERSION 67
+#define SUBVERSION 68
#endif