This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines


   Date: Sat, 7 Aug 2004 21:49:44 -0700
   From: Joel Brobecker <brobecker@gnat.com>

   config/xm-aix4.h has the following definitions:

   | #define FIVE_ARG_PTRACE

This one really belongs in a nm.h file.  How about moving it to
rs6000/nm-rs6000.h.

   | /* This system requires that we open a terminal with O_NOCTTY for it to
   |    not become our controlling terminal.  */
   | #define USE_O_NOCTTY

   For this one, it seems that we have no choice but to hard-code somewhere
   that terminals should be opened using O_NOCTTY on AIX. Configure seems
   as good a place a any.

I think we can sidestep that one easily.  I believe that on most
modern systems, O_NOCTTY is a no-op, and that we really want it on
systems where it isn't a no-op.  If we look at its usage in GDB, it is
obvious that the code is trying to open a terminal without it becoming
a controlling terminal.  And indeed on modern *BSD, where O_NCTTY is a
no-op since open(2) doesn't cause the terminal to become a controlling
terminal, everything works OK.  So I'm relatively confident that we
can simply apply the attached patch to inflow.c and get rid of
USE_O_NOCTTY completely.

I'll check in the patch next weekend if nobody objects.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* inflow.c (O_NOCTTY): Define to zero if not already defined.
	(new_tty): Use O_NOCTTY unconditionally.

 
Index: inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.23
diff -u -p -r1.23 inflow.c
--- inflow.c 30 Jul 2004 12:05:44 -0000 1.23
+++ inflow.c 8 Aug 2004 11:47:51 -0000
@@ -42,6 +42,10 @@
 #include <sys/ioctl.h>
 #endif
 
+#ifndef O_NOCTTY
+#define O_NOCTTY 0
+#endif
+
 #if defined (SIGIO) && defined (FASYNC) && defined (FD_SET) && defined (F_SETOWN)
 static void handle_sigio (int);
 #endif
@@ -537,12 +541,7 @@ new_tty (void)
 #endif
 
   /* Now open the specified new terminal.  */
-
-#ifdef USE_O_NOCTTY
   tty = open (inferior_thisrun_terminal, O_RDWR | O_NOCTTY);
-#else
-  tty = open (inferior_thisrun_terminal, O_RDWR);
-#endif
   if (tty == -1)
     {
       print_sys_errmsg (inferior_thisrun_terminal, errno);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]