Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines
@ 2004-08-08  4:49 Joel Brobecker
  2004-08-08 11:50 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2004-08-08  4:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Cagney, Peter Schauer, Kevin Buettner

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

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

Should be detected by configure instead of being hard-wired in this
file. I would probably need some help there: The lazy approach would
be to detect the few hosts by name and then define this on these systems.
But is there a way that would be generic? Normally, we rely on trying to
compile some code, but all we'll have here is a warning, not a compilation
failure... How 

| #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.

Opinions?

-- 
Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines
  2004-08-08  4:49 [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines Joel Brobecker
@ 2004-08-08 11:50 ` Mark Kettenis
  2004-08-08 13:51   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2004-08-08 11:50 UTC (permalink / raw)
  To: brobecker; +Cc: gdb-patches, cagney, Peter.Schauer, kevinb

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines
  2004-08-08 11:50 ` Mark Kettenis
@ 2004-08-08 13:51   ` Andrew Cagney
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2004-08-08 13:51 UTC (permalink / raw)
  To: Mark Kettenis, brobecker; +Cc: gdb-patches, cagney, Peter.Schauer, kevinb

>    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.

Joel's correct here.

ptrace(), just like printf, "double", or <string.h>, is just another 
host function that can, well at least in theory, be probed by autoconf. 
  I'm just not sure how we can probe the attributes we need: 
FIVE_ARG_PTRACE, PTRACE_ARG3_TYPE, TRACE_XFER_TYPE, ...

Andrew

PS: nm*.h is also well on its way to the chopping block.  It's contents 
have well and truely been reduced to a bunch of hacks that should be in 
the target/gdbarch vectors and/or autoconf.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-08-08 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-08  4:49 [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines Joel Brobecker
2004-08-08 11:50 ` Mark Kettenis
2004-08-08 13:51   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox