[comp.sys.hp] GNU Emacs 18.55 on HPUX 7.0

tgl@zog.cs.cmu.edu (Tom Lane) (04/11/90)

Herewith an installation report on bringing up GNU Emacs 18.55
under HPUX 7.0.  I had had it running under 6.2, but encountered
a couple of snafus in rebuilding after the upgrade.

The environment here is vanilla HPUX 7.0 and Emacs 18.55 pretty
much out-of-the-box: src/config.h selects s-hpux.h and m-hp9000s300.h,
and defines HAVE_X_WINDOWS and X11.  I also modify src/ymakefile
to specify +O1 in place of -g.  (-O draws warning messages...)

The first problem you'll run into when building is a compiler complaint
about the stub "perror()" routine in src/sysdep.c.  Since HPUX has perror()
I don't see the value in this stub; I just flushed it.  (No diff for this:
just change #ifdef HPUX to #if 0.)  After that it should build and install
without error.

A couple of people have reported problems with interrupts to
subjobs not working under HPUX 7.0: typing C-c C-c doesn't
seem to do anything, and typing C-c C-\ kills Emacs itself.
I've tracked down the problem and enclose diffs for a possible fix.

The problem is that under HPUX 7.0 you can't do TIOCGPGRP on the
master side of a pty (don't ask me why not -- it worked under 6.2).
The code below avoids TIOCGPGRP entirely in favor of TIOCSIGSEND,
which sends the signal directly.

This should work OK in HPUX 6.2 also, but I am not about to reinstall
6.2 to try it.  I don't know how widespread TIOCSIGSEND is (CMU's
BSD 4.3 machines don't seem to have it); making the change conditional
on TIOCSIGSEND being defined may be the wrong thing to do.

This code will not work if the connection is via pipe or socket
rather than pty, but I don't believe the old code would have either.
At least I give an error message...

*** src/process.c.old	Fri Mar 16 12:13:22 1990
--- src/process.c	Tue Apr 10 11:35:17 1990
***************
*** 1771,1776 ****
--- 1771,1780 ----
      error ("Process %s is not active",
  	   XSTRING (p->name)->data);
  
+ #ifdef TIOCSIGSEND
+   if (NULL (current_group))
+     gid = - XFASTINT (p->pid);
+ #else /* don't have TIOCSIGSEND */
  #ifdef TIOCGPGRP		/* Not sure about this! (fnf) */
    /* If we are using pgrps, get a pgrp number and make it negative.  */
    if (!NULL (current_group))
***************
*** 1785,1790 ****
--- 1789,1795 ----
       the child itself heads the pgrp.  */
    gid = - XFASTINT (p->pid);
  #endif /* not using pgrps */
+ #endif /* TIOCSIGSEND */
  
    switch (signo)
      {
***************
*** 1800,1805 ****
--- 1805,1820 ----
        flush_pending_output (XFASTINT (p->infd));
        break;
      }
+ 
+ #ifdef TIOCSIGSEND
+   if (!NULL (current_group))
+     {
+       if (ioctl (XFASTINT (p->infd), TIOCSIGSEND, signo) == -1)
+ 	error ("Failed to signal process %s",
+ 	       XSTRING (p->name)->data);
+     }
+   else
+ #endif /* TIOCSIGSEND */
    /* gid may be a pid, or minus a pgrp's number */
  #ifdef BSD
    /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.

-- 
				tom lane
Internet: tgl@cs.cmu.edu
UUCP: <your favorite internet/arpanet gateway>!cs.cmu.edu!tgl
BITNET: tgl%cs.cmu.edu@cmuccvma
CompuServe: >internet:tgl@cs.cmu.edu

guy@auspex.auspex.com (Guy Harris) (04/12/90)

>The problem is that under HPUX 7.0 you can't do TIOCGPGRP on the
>master side of a pty (don't ask me why not -- it worked under 6.2).

I don't know whether HP-UX supports BSD-style "asynchronous I/O", but
perhaps they decided to implement it on pseudo-tty masters?  In order to
make it work, you have to provide some way of setting the process or
process group to which the SIGIO should be sent; SunOS 4.x does so by
supporting *only* the F_GETOWN and F_SETOWN BSD "fcntl"s for
manipulating the master's process group, so that old programs that do
TIOCGPGRP or TIOCSPGRP on the master side of a pty still work. 

>I don't know how widespread TIOCSIGSEND is (CMU's BSD 4.3 machines
>don't seem to have it);

It's not in vanilla 4.3BSD or 4.3-tahoe.

It *is* in SunOS 3.2 and later, as I remember, and I think it's in
System V Release 4 as well - except that it's called "TIOCSIGNAL"
instead, and takes a pointer to an "int" containing the signal number
rather than, as I infer from your code TIOCSIGSEND does, taking the
signal number as an argument.

I hope to browbeat Berkeley into providing TIOCSIGNAL in 4.4BSD (Dave
Borman's patches for his new "telnet" add something called TIOCSIG -
just what we need, a *third* name for this function! - that's TIOCSIGNAL
with a different name). 

HP might want to consider offering TIOCSIGNAL as well as TIOCSIGSEND in
a future release.

irf@kuling.UUCP (Bo Thide') (04/12/90)

In article <3163@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
>>The problem is that under HPUX 7.0 you can't do TIOCGPGRP on the
>>master side of a pty (don't ask me why not -- it worked under 6.2).
>
>HP might want to consider offering TIOCSIGNAL as well as TIOCSIGSEND in
>a future release.

A "grep TIOCSIGSEND" on /usr/include/sys/* in HP-UX 7.0 (300 series) gives
the following:

/usr/include/sys/ptyio.h:#define        TIOCSIGSEND     _IO('t', 93)

I assume that this is the TIOCSIGSEND you are looking for.

Bo


   ^   Bo Thide'--------------------------------------------------------------
  | |       Swedish Institute of Space Physics, S-755 91 Uppsala, Sweden
  |I|    [In Swedish: Institutet f|r RymdFysik, Uppsalaavdelningen (IRFU)]
  |R|  Phone: (+46) 18-403000.  Telex: 76036 (IRFUPP S).  Fax: (+46) 18-403100 
 /|F|\        INTERNET: bt@irfu.se       UUCP: ...!uunet!sunic!irfu!bt
 ~~U~~ -----------------------------------------------------------------sm5dfw

guy@auspex.auspex.com (Guy Harris) (04/14/90)

>I assume that this is the TIOCSIGSEND you are looking for.

The TIOCSIGSEND I'm referring to is the one to which the author of the
article to which I replied referred.  That's probably the one you found,
but you'll have to take it up with said author to be sure....