🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99222

(none)

#99222
From: root%h-three
Date: Wed, 24 Oct 1990 04:35
98 lines
4381 bytes
To: rti!mcnc!gnu-emacs-bug
Path: h-three!rti!mcnc!rutgers!tut.cis.ohio-state.edu!relay.eu.net!dutentb!stravers
From: dutentb!stravers@relay.eu.net
Newsgroups: gnu.emacs.bug
Subject: bug in sig_process() on HPUX 7.0
Message-ID: <9010010837.AA15646@hp4nl.nluug.nl>
Date: 1 Oct 90 10:30:27 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: stravers@dutentb.tudelft.nl
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 84


Following reports a bug in GNUemacs 18.55 for HPUX. A patch is included.

Program:            GNU emacs 18.55

Operating system:   HPUX 6.5 and HPUX 7.0

Hardware:           hp9k800, hp9k300

Problem:
Emacs is unable to send signals to inferior processes, as required for the
elisp functions interrupt-process, kill-process, etc. Consequently, \C-c\C-c in
shell-mode does not send signal 2 to the shell's subjob, in latex-mode \C-c\C-k
does not kill the running latex process, etc.

Cause  -- where it fails:
The following system call in the file src/process.c, function sig_process()
fails:

      if (!NULL (current_group))
        {
>>>       ioctl (XFASTINT (p->infd), TIOCGPGRP, &gid);   <<<<<<<< FAIL *****
          gid = - gid;
        }

The call is supposed to set gid to the process group id of the process that is
currently in the foreground of the controlling terminal whos fildes is p->infd.
In stead, ioctl returns -1 and sets errno to ENOTTY. According to the manual
page termio(7) this means that "the file associated with XFASTINT(p->infd) is
not the controlling terminal, or the calling process does not have a
controlling terminal". Here the "calling process" is emacs and the file
descriptor XFASTINT(p->infd) refers to the master side of the pty that emacs
uses to communicate with the inferior process.

Cause -- why it fails:
It seems that hpux only allows background processes WITHIN a terminal session
to obtain the gid of that sessions current foreground process.  Since the
inferior process creates its own session just after emacs forks [with the call
setpgrp()], emacs is OUTSIDE the inferior process session, hence the above
mentioned ioctl fails.

Suggested solution:
In hpux we can (must) combine the two distinct calls
          1.    ioctl ( fildes, TIOCGPGRP, &gid);
          2.    kill (-gid, signo);
into the single call
          1+2.  ioctl( fildes, TIOCSIGSEND, signo);
According to the man page pty(7) this sends the signal signo to the current tty
process group of the pty slave side.  Here are the cdiffs: 

*** process_old.c
--- process.c
**************
*** 1819,1824
       Must do that differently.  */
    killpg (-gid, signo);
  #else /* Not BSD.  */
    kill (gid, signo);
  #endif /* HPUX */
  #endif /* Not BSD.  */
--- 1819,1827 -----
       Must do that differently.  */
    killpg (-gid, signo);
  #else /* Not BSD.  */
+ #ifdef HPUX /* previous ioctl failed, gid is not valid */
+   ioctl( XFASTINT (p->infd), TIOCSIGSEND, signo);
+ #else
    kill (gid, signo);
+ #endif /* HPUX */
  #endif /* Not BSD.  */

Two notes on the patch:
  1. After this patch sig_process() still executes the failing ioctl, but since
     we discard the resulting gid anyway this does no harm.
  2. These diffs apply to the file src/process.c AFTER I patched it with Piet
     van Oostrum's (piet@cs.ruu.nl) patches to make ^G work for HPUX/X-windows.
     If you cannot get them, mail me and I'll send 'm to you.

Paul Stravers
Delft University of Technology (faculty of EE)
The Netherlands

     __           __                                                  __
____/  |____     |  \_paul__     _                                 __/  \_____
            |____|          |___/ \__stravers@dutentb.tudelft.nl__/
Technical Details
Message-ID: <9010240435.AA01166@rtifs1.rti.org>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!usc!cs.utexas.edu!tut.cis.ohio-state.edu!RTI.RTI.ORG!root%h-three

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,f1dbc4b61e8e8143
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-10-23 21:35:16 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!shelby!apple!usc!cs.utexas.edu!tut.cis.ohio-state.edu!RTI.RTI.ORG!root%h-three
From: root%h-three@RTI.RTI.ORG
Newsgroups: gnu.emacs.bug
Subject: (none)
Message-ID: <9010240435.AA01166@rtifs1.rti.org>
Date: 24 Oct 90 04:35:16 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Gnus Not Usenet
Lines: 98
Approved: bug-gnu-emacs@prep.ai.mit.edu
Posted: Wed Oct 24 05:35:16 1990