From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: EMACS_GET_TTY_PGRP vs. emacs_get_tty_pgrp Date: Wed, 20 Oct 2010 16:28:28 -0400 Message-ID: References: <4CBEFB15.5050303@cornell.edu> <4CBF4AA6.3000200@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1287606517 7399 80.91.229.12 (20 Oct 2010 20:28:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Oct 2010 20:28:37 +0000 (UTC) Cc: emacs-devel To: Ken Brown Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 20 22:28:36 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P8fH1-0007qv-K7 for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 22:28:35 +0200 Original-Received: from localhost ([127.0.0.1]:36471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8fH1-0004Rg-1c for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 16:28:35 -0400 Original-Received: from [140.186.70.92] (port=52392 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8fGw-0004RT-Kt for emacs-devel@gnu.org; Wed, 20 Oct 2010 16:28:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8fGv-0000iQ-Gk for emacs-devel@gnu.org; Wed, 20 Oct 2010 16:28:30 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:33869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8fGv-0000iM-E9 for emacs-devel@gnu.org; Wed, 20 Oct 2010 16:28:29 -0400 Original-Received: from dann by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1P8fGu-0005oK-Rw; Wed, 20 Oct 2010 16:28:28 -0400 In-Reply-To: <4CBF4AA6.3000200@cornell.edu> (Ken Brown's message of "Wed\, 20 Oct 2010 16\:01\:42 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:131910 Archived-At: Ken Brown writes: > On 10/20/2010 2:59 PM, Dan Nicolaescu wrote: >> Ken Brown writes: >> >>> The macro EMACS_GET_TTY_PGRP defined in src/systty.h uses either >>> tcgetpgrp or TIOCGPGRP to get the PGID of a terminal's foreground >> >> It does not: >> >> #ifndef DOS_NT >> #define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) >> #define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) >> #endif /* not DOS_NT */ >> >> also, I have a patch to remove this, it's only used in two places, so >> it's not very useful as an abstraction. > > Oops. I looked at the emacs-23 branch but not the trunk. Sorry for > the confusion. > > But then I still think emacs_get_tty_pgrp in process.c should be > changed so that it works on systems that have tcgetpgrp but not > TIOCGPGRP. How would you recommend handling this? Is it necessary to > use conditional code as in the emacs-23 definition of > EMACS_GET_TTY_PGRP, or is it safe to just always use tcgetpgrp as in > the trunk's version of EMACS_GET_TTY_PGRP? It think your question compounds two issues. EMACS_GET/SET_TTY_PGRP should die, they are not useful as abstractions anymore. The comment in emacs_get_tty_pgrp looks scary, it does not look obvious that the code in the function can be replaced with tcgetpgrp. Maybe it can, but, IMHO, it needs testing on a few platforms.