Fix -Wuh and -Wnhu options so that they work.
[deliverable/binutils-gdb.git] / gdb / inflow.c
index 6c5b793b445a2dc3edffa51cc32e0944564fbd1b..6ce7721a93b2779f6abe5804234e0d75678ff661 100644 (file)
@@ -1,5 +1,5 @@
 /* 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.
 
@@ -33,11 +33,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #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?  */
@@ -52,6 +59,8 @@ static void
 handle_sigio PARAMS ((int));
 #endif
 
+extern void _initialize_inflow PARAMS ((void));
+
 static void
 pass_signal PARAMS ((int));
 
@@ -103,7 +112,7 @@ static char *inferior_thisrun_terminal;
    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;
 
@@ -138,6 +147,9 @@ gdb_has_a_terminal ()
 #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
@@ -190,17 +202,13 @@ void
 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 */
 }
 
@@ -233,7 +241,9 @@ terminal_inferior ()
       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
@@ -326,6 +336,9 @@ terminal_ours_1 (output_only)
 #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
@@ -375,7 +388,9 @@ terminal_ours_1 (output_only)
       if (!job_control)
        {
          signal (SIGINT, sigint_ours);
+#ifdef SIGQUIT
          signal (SIGQUIT, sigquit_ours);
+#endif
        }
 
 #ifdef F_GETFL
@@ -497,7 +512,7 @@ new_tty ()
 
   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
@@ -578,7 +593,9 @@ static void
 pass_signal (signo)
     int signo;
 {
-  kill (inferior_pid, SIGINT);
+#ifndef _WIN32
+  kill (PIDGET (inferior_pid), SIGINT);
+#endif
 }
 
 static void (*osig)();
@@ -618,8 +635,10 @@ handle_sigio (signo)
   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
     }
 }
 
This page took 0.024765 seconds and 4 git commands to generate.