From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6852 invoked by alias); 18 May 2006 22:51:05 -0000 Received: (qmail 6844 invoked by uid 22791); 18 May 2006 22:51:05 -0000 X-Spam-Check-By: sourceware.org Received: from eastrmmtao02.cox.net (HELO eastrmmtao02.cox.net) (68.230.240.37) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 May 2006 22:51:02 +0000 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060518225100.OOT15470.eastrmmtao02.cox.net@localhost.localdomain>; Thu, 18 May 2006 18:51:00 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FgrKi-0005XS-C7; Thu, 18 May 2006 18:51:04 -0400 Date: Thu, 18 May 2006 23:25:00 -0000 From: Bob Rossi To: Andreas Schwab Cc: Jim Blandy , Alain Magloire , gdb@sources.redhat.com Subject: Re: invoking GDB from FE and signals Message-ID: <20060518225104.GF21003@brasko.net> Mail-Followup-To: Andreas Schwab , Jim Blandy , Alain Magloire , gdb@sources.redhat.com References: <3518719F06577C4F85DA618E3C37AB91054A9EFD@nimbus.ott.qnx.com> <20060518172253.GE21003@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00288.txt.bz2 On Thu, May 18, 2006 at 11:49:01PM +0200, Andreas Schwab wrote: > Bob Rossi writes: > > > I find in emacs:process.c code that they send the SIGINT in different > > ways > > /* If possible, send signals to the entire pgrp > > by sending an input character to it. */ > > > > /* TERMIOS is the latest and bestest, and seems most likely to > > work. If the system has it, use it. */ > > case SIGINT: > > sig_char = &t.c_cc[VINTR]; > > break; > > ... > > send_process (proc, sig_char, 1, Qnil); > > This part is only active if SIGNALS_VIA_CHARACTERS is defined. That is > defined mostly for BSD-derived systems, but not, for example, for Linux. > The fallback is to send the signal to the foreground process group of the > terminal. Thanks Andreas, I see now. The code is below on how to get the foreground process group. I see that it get's the process group and then calls killpg. Is this the prefered way of sending a single to the inferior? I am only now realizing how many different case's that emacs supports. Thanks, Bob Rossi /* Return the foreground process group for the tty/pty that the process P uses. */ static int emacs_get_tty_pgrp (p) struct Lisp_Process *p; { int gid = -1; #ifdef TIOCGPGRP if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name)) { int fd; /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the master side. Try the slave side. */ fd = emacs_open (XSTRING (p->tty_name)->data, O_RDONLY, 0); if (fd != -1) { ioctl (fd, TIOCGPGRP, &gid); emacs_close (fd); } } #endif /* defined (TIOCGPGRP ) */ return gid; }