/* Low level interface to ptrace, for GDB when running under Unix.
- Copyright 1986, 1987, 1989, 1991, 1992, 1995 Free Software Foundation, Inc.
+ Copyright 1986-87, 1989, 1991-92, 1995, 1998 Free Software Foundation, Inc.
This file is part of GDB.
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
#ifdef HAVE_TERMIOS
#define PROCESS_GROUP_TYPE pid_t
#endif
+#ifdef HAVE_TERMIO
+#define PROCESS_GROUP_TYPE int
+#endif
+
#ifdef HAVE_SGTTY
#ifdef SHORT_PGRP
/* This is only used for the ultra. Does it have pid_t? */
handle_sigio PARAMS ((int));
#endif
+extern void _initialize_inflow PARAMS ((void));
+
static void
pass_signal PARAMS ((int));
inferior's settings are in effect. Ignored if !gdb_has_a_terminal
(). */
-static int terminal_is_ours;
+int terminal_is_ours;
enum {yes, no, have_not_checked} gdb_has_a_terminal_flag = have_not_checked;
#ifdef HAVE_TERMIOS
our_process_group = tcgetpgrp (0);
#endif
+#ifdef HAVE_TERMIO
+ our_process_group = getpgrp ();
+#endif
#ifdef HAVE_SGTTY
ioctl (0, TIOCGPGRP, &our_process_group);
#endif
terminal_init_inferior ()
{
#ifdef PROCESS_GROUP_TYPE
-#ifdef PIDGET
/* This is for Lynx, and should be cleaned up by having Lynx be a separate
debugging target with a version of target_terminal_init_inferior which
passes in the process group to a generic routine which does all the work
(and the non-threaded child_terminal_init_inferior can just pass in
inferior_pid to the same routine). */
+ /* We assume INFERIOR_PID is also the child's process group. */
terminal_init_inferior_with_pgrp (PIDGET (inferior_pid));
-#else
- /* By default, we assume INFERIOR_PID is also the child's process group. */
- terminal_init_inferior_with_pgrp (inferior_pid);
-#endif
#endif /* PROCESS_GROUP_TYPE */
}
if (!job_control)
{
sigint_ours = (void (*) ()) signal (SIGINT, SIG_IGN);
+#ifdef SIGQUIT
sigquit_ours = (void (*) ()) signal (SIGQUIT, SIG_IGN);
+#endif
}
/* If attach_flag is set, we don't know whether we are sharing a
#ifdef HAVE_TERMIOS
inferior_process_group = tcgetpgrp (0);
#endif
+#ifdef HAVE_TERMIO
+ inferior_process_group = getpgrp ();
+#endif
#ifdef HAVE_SGTTY
ioctl (0, TIOCGPGRP, &inferior_process_group);
#endif
if (!job_control)
{
signal (SIGINT, sigint_ours);
+#ifdef SIGQUIT
signal (SIGQUIT, sigquit_ours);
+#endif
}
#ifdef F_GETFL
if (inferior_thisrun_terminal == 0)
return;
-#if !defined(__GO32__) && !defined(__WIN32__)
+#if !defined(__GO32__) && !defined(_WIN32)
#ifdef TIOCNOTTY
/* Disconnect the child process from our controlling terminal. On some
systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
pass_signal (signo)
int signo;
{
- kill (inferior_pid, SIGINT);
+#ifndef _WIN32
+ kill (PIDGET (inferior_pid), SIGINT);
+#endif
}
static void (*osig)();
numfds = select (target_activity_fd + 1, &readfds, NULL, NULL, NULL);
if (numfds >= 0 && FD_ISSET (target_activity_fd, &readfds))
{
+#ifndef _WIN32
if ((*target_activity_function) ())
kill (inferior_pid, SIGINT);
+#endif
}
}