[comp.emacs] Gnu-emacs on the hp9000

deb@svax.cs.cornell.edu (David Baraff) (06/14/88)

I'm having the following problem with gnuemacs 18.50, running under
HPUX on an 825 (and a 325). I'm running gnuemacs under X10, and such that
gnuemacs is NOT running in an xterm, rather it is doing the display
itself (i.e. talking to the X server).

Now, when I stop my xsession (by whatever means), this gnu-emacs
should terminate. Also, suppose I'm running gnuemacs on some (remote) machine,
on my (local) display. When I stop my local xsession, the gnuemacs
on the remote should also stop.

The problem, of course, is that in neither case does gnuemacs seem
to realize that the X server it has been talking to has died!
So, gnuemacs just hangs around, taking up space and cycles, doing
nothing. Other X programs (i.e. xterm etc) realize when the X server
dies and exit accordingly. So, any insight? Is this problem local
to HPUX? Any suggested fixes -- like checking for a broken pipe
on the X socket perhaps? [ I have no idea where to start looking for
this though...]

	Any help appreciated,

		David Baraff
		deb@svax.cs.cornell.edu

arndt@zyx.SE (Arndt Jonasson) (06/26/88)

In article <18267@cornell.UUCP> deb@svax.cs.cornell.edu (David Baraff) writes:
>
>I'm having the following problem with gnuemacs 18.50, running under
>HPUX on an 825 (and a 325). I'm running gnuemacs under X10, and such that
>gnuemacs is NOT running in an xterm, rather it is doing the display
>itself (i.e. talking to the X server).
>
>[Describing problem with Emacs not exiting when the X session is
>terminated].

We have the same configuration, except we have 18.49.

The relevant file is xterm.c, in which there is a piece of code
designed to make Emacs get a SIGPIPE or an X error when the X server
disappears, thus causing Emacs to exit. Curiously enough, that code is
#ifndef HPUX. Just remove the #ifndef-#endif pair and remake Emacs.
You'll probably need to add the option +Ns2000 when compiling xterm.c,
in order not to get a symbol table overflow. We have run Emacs in this
way for some time now with no ill effects.

Before I discovered the above commented-out code, I added some code of
my own, and here is what the end of the function XTread_socket looks
like in our Emacs. If ill effects should in fact arise, use this code
instead, changing the #if 0 to #if 1.

#if 0
  /* AOJ 880406: if select returns true but XPending doesn't, it means that
     there is an EOF condition; in other words, that X has died.
     Act as if there had been a hangup. */
  {
     int d = dispno ();
     int mask = 1 << d;

     if (select (d+1, &mask, (long *) 0, (long *) 0,
		 (struct timeval *) 0) != 0
	 && !XPending ())
	kill (getpid (), SIGHUP);
  }
#endif
  if (count < 0)
    count = 0;
#ifndef HPUX
  if (CursorExists)
    xfixscreen ();
#endif
  UNBLOCK_INPUT ();
  return count;
}


A note to the developers: please always include a small comment saying
why this and that system was #ifdef'ed away; it makes the work easier
for others.


A question of my own: does anybody know why the screen doesn't always
get updated when using Gnu Emacs in the way described above on an
HP9000/800, though it does on an HP9000/300? For instance performing a
Meta-command and keeping the Meta-key pressed sometimes results in the
screen not being updated.
-- 
Arndt Jonasson, ZYX Sweden AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address:	 arndt@zyx.SE	or	<backbone>!mcvax!enea!zyx!arndt