From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.devel Subject: Re: EMACS_GET_TTY_PGRP vs. emacs_get_tty_pgrp Date: Wed, 20 Oct 2010 17:28:07 -0400 Message-ID: <4CBF5EE7.4010405@cornell.edu> References: <4CBEFB15.5050303@cornell.edu> <4CBF4AA6.3000200@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1287610095 25725 80.91.229.12 (20 Oct 2010 21:28:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Oct 2010 21:28:15 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 20 23:28:14 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 1P8gCh-0000pH-0X for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 23:28:11 +0200 Original-Received: from localhost ([127.0.0.1]:46933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8gCg-0007kI-91 for ged-emacs-devel@m.gmane.org; Wed, 20 Oct 2010 17:28:10 -0400 Original-Received: from [140.186.70.92] (port=44745 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8gCa-0007kC-AU for emacs-devel@gnu.org; Wed, 20 Oct 2010 17:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8gCZ-0002IH-42 for emacs-devel@gnu.org; Wed, 20 Oct 2010 17:28:04 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141]:61241 helo=authusersmtp.mail.cornell.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8gCX-0002Hq-C0; Wed, 20 Oct 2010 17:28:01 -0400 Original-Received: from [128.84.234.191] (markov.math.cornell.edu [128.84.234.191]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id o9KLS0Si025240 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 20 Oct 2010 17:28:00 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Solaris 9 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:131913 Archived-At: On 10/20/2010 4:28 PM, Dan Nicolaescu wrote: > 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. I think I'm just going to let this drop. I had thought I could simplify the code, but it looks like it would just get more complicated, and it's not worth the trouble.