Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: brobecker@gnat.com
Cc: gdb-patches@sources.redhat.com, cagney@redhat.com,
	Peter.Schauer@regent.e-technik.tu-muenchen.de, kevinb@redhat.com
Subject: Re: [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines
Date: Sun, 08 Aug 2004 11:50:00 -0000	[thread overview]
Message-ID: <200408081149.i78Bn73Q009793@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <20040808044944.GD24160@gnat.com> (message from Joel Brobecker on Sat, 7 Aug 2004 21:49:44 -0700)

   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);


  reply	other threads:[~2004-08-08 11:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-08  4:49 Joel Brobecker
2004-08-08 11:50 ` Mark Kettenis [this message]
2004-08-08 13:51   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408081149.i78Bn73Q009793@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=Peter.Schauer@regent.e-technik.tu-muenchen.de \
    --cc=brobecker@gnat.com \
    --cc=cagney@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox