From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22264 invoked by alias); 8 Aug 2004 11:50:37 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22257 invoked from network); 8 Aug 2004 11:50:36 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.77.109) by sourceware.org with SMTP; 8 Aug 2004 11:50:36 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i78Bn9oa003265; Sun, 8 Aug 2004 13:49:09 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i78Bn9SP009796; Sun, 8 Aug 2004 13:49:09 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i78Bn73Q009793; Sun, 8 Aug 2004 13:49:07 +0200 (CEST) Date: Sun, 08 Aug 2004 11:50:00 -0000 Message-Id: <200408081149.i78Bn73Q009793@elgar.kettenis.dyndns.org> From: Mark Kettenis To: brobecker@gnat.com CC: gdb-patches@sources.redhat.com, cagney@redhat.com, Peter.Schauer@regent.e-technik.tu-muenchen.de, kevinb@redhat.com In-reply-to: <20040808044944.GD24160@gnat.com> (message from Joel Brobecker on Sat, 7 Aug 2004 21:49:44 -0700) Subject: Re: [RFC/AIX] xm-aix4.h - Remove FIVE_ARG_PTRACE & USE_O_NOCTTY defines References: <20040808044944.GD24160@gnat.com> X-SW-Source: 2004-08/txt/msg00244.txt.bz2 Date: Sat, 7 Aug 2004 21:49:44 -0700 From: Joel Brobecker 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 * 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 #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);