[10467] in Athena Bugs

home help back first fref pref prev next nref lref last post

[bug-gnu-emacs-request@prep.ai.mit.edu: Re: restore terminal modes problem on aix]

daemon@ATHENA.MIT.EDU (epeisach@Athena.MIT.EDU)
Mon Apr 26 09:42:25 1993

From: epeisach@Athena.MIT.EDU
To: bugs@Athena.MIT.EDU
Date: Mon, 26 Apr 93 09:23:54 EDT


Not sure if this is relevant, but if a dialup rs/6000 shows up, we may
see it....

	Ezra

------- Forwarded Message

Received: from ATHENA-AS-WELL.MIT.EDU by e40-po.MIT.EDU (5.61/4.7) id AA21435; Sat, 24 Apr 93 01:55:50 EDT
Received: from life.ai.mit.edu by Athena.MIT.EDU with SMTP
	id AA03872; Sat, 24 Apr 93 01:55:48 EDT
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA02852; Sat, 24 Apr 93 00:41:32 EDT
Return-Path: <gnulists@ai.mit.edu>
Received: from pop-tarts (pop-tarts.ai.mit.edu) by life.ai.mit.edu (4.1/AI-4.10) id AA02817; Sat, 24 Apr 93 00:41:13 EDT
Received: by pop-tarts (4.1/AI-4.10) id AA04108; Sat, 24 Apr 93 00:41:10 EDT
Resent-Date: Fri, 23 Apr 93 20:37:06 EDT
Resent-Message-Id: <9304240441.AA04108@pop-tarts>
Received: from rodan.UU.NET by life.ai.mit.edu (4.1/AI-4.10) id AA28314; Fri, 23 Apr 93 20:37:38 EDT
Received: from relay1.UU.NET by rodan.UU.NET with SMTP 
	(5.61/UUNET-mail-drop) id AA19982; Fri, 23 Apr 93 20:37:38 -0400
Received: from das.wang.com by relay1.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AA05598; Fri, 23 Apr 93 20:37:35 -0400
Received: from elf.wang.com by das.wang.com with SMTP id AA23493
  (5.65c/IDA-1.5 for <uunet!gnu-emacs-bug>); Fri, 23 Apr 1993 20:37:31 -0400
Received: by elf.wang.com id AA03299
  (5.65c/IDA-1.5 for uunet!gnu-emacs-bug); Fri, 23 Apr 1993 20:37:11 -0400
X-Mailer: SCO System V Mail (version 3.2)
Original-To: uunet!gnu-emacs-bug@uunet.uu.net
Date: Fri, 23 Apr 93 20:37:06 EDT
Resent-From: bug-gnu-emacs-request@prep.ai.mit.edu
Newsgroups: gnu.emacs.bug
Path: wjs
From: wjs@wang.com (William Smith)
Sender: gnulists@ai.mit.edu
Organization: Wang Labs, Lowell MA, USA
Date: Sat, 24 Apr 1993 00:36:55 GMT
Message-Id: <C5yppM.2IC@wang.com>
References: <CMM.0.90.2.735431561.valaine@sadr.usc.edu>
To: bug-gnu-emacs@prep.ai.mit.edu
Subject: Re: restore terminal modes problem on aix

valaine@usc.edu writes:

>version: GNU Emacs 18.59.14 of Thu Apr 15 1993 on nerf.usc.edu (aix-v3)
>os: aix 3.2
>system type: rs/6000

>after quitting emacs, the terminal mode would sometimes (~50%) be
>messed up and a "^Jreset^J" typed to the shell would have to be done.
>this only happened on high end rs6000's, our model 970 servers.  an
>rs6000/540 workstation did not exhibit the problem.  speculating that
>it was a race condition issue, i took the expedient way and made this
>fix.  i apologize for the crudeness.  i only spent a short time
>looking at the problem and since the fix seems to work, i've not
>investigated further.

>Valaine Saito
>USC University Computing Services
>INTERNET: valaine@usc.edu                 PHONE: (213) 740-2957

>*** sysdep.c	Sat Sep 12 00:25:30 1992
>--- sysdep.c.new	Tue Apr 13 18:04:56 1993
>***************
>*** 1269,1274 ****
>--- 1269,1277 ----
>  #endif
>  #ifdef TIOCGLTC
>    ioctl (0, TIOCSLTC, &old_ltchars);
>+ #ifdef IBMR2AIX
>+   sleep (1);
>+ #endif /* IBMR2AIX */
>  #endif /* TIOCGLTC */
>  #ifndef HAVE_TERMIO
>  #ifdef TIOCGETC

   I've also found a way around this problem with emacs 18.58 and
18.59 on IBM rs6000/AIX 3.2.0.

   The problem was traced to the POSIX definition of the `tcsetattr'
call.  According to POSIX 1003.1 committee, `tcsetattr' shall return
success if it was able to perform any of the requested actions, even
if some of the requested actions could not be performed.  This indeed
proved to be the case on AIX.  When the terminal locked, 'tcsetattr'
had returned success even though terminal was not restored to its
original settings.  Obviously, this ..feature.. of `tcsetattr' may
cause problems in other areas of emacs.  Versions prior to 18.58 used
the old `ioctl' calls to setup the terminal.

   The only reliable way to use `tcsetattr' is either change one
terminal attribute at a time or implement a loop similar to my patch
to the reset_sys_modes() in the sysdep.c module.  The diff of my
implementation follows.

- ----start diff of sysdep.c---------
1236,1238d1235
<   TERMINAL save_gtty;
<   int	   tty_ok;
<   
1303,1315c1300
<   /* POSIX 1003.1 defines tcsetattr() to return success if it was
<      able to perform any of the requested actions, even if some
<      of the requested actions could not be performed.
<      We must read settings back to ensure tty setup properly.
<      AIX requires this to keep tty from hanging occasionally. */
<   tty_ok = FALSE;
<   while (!tty_ok)
<     {
<       while (tcsetattr (0, TCSADRAIN, &old_gtty) < 0 && errno == EINTR);
<       tcgetattr (0, &save_gtty);
<       if (memcmp (&save_gtty, &old_gtty, sizeof(save_gtty)) == 0)
<         tty_ok = TRUE;
<     }
- ---
>   while (tcsetattr (0, TCSADRAIN, &old_gtty) < 0 && errno == EINTR);




- -- 
/*-------------------------------------------------------------------------
   William J. Smith, Wang Labs M/S 019-72B, 1 Industrial Ave      
   Lowell, MA 01851-5161,  (508) 967-6901, email: wjs@wiis.wang.com
- --------------------------------------------------------------------------*/


------- End of Forwarded Message


home help back first fref pref prev next nref lref last post