Path: utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!topexp.co.uk!rde From: mcvax!topexp.co.uk!rde@UUNET.UU.NET (Richard Evans) Newsgroups: gnu.emacs.bug Subject: GNU Emacs and Sun ALM-2s Message-ID: <6323.8901181531@igor.topexp.co.uk> Date: 18 Jan 89 15:31:58 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 132 This is a note about a couple of problems we had when using GNU Emacs version 18.49 with Sun ALM-2 (16 port multiplexor) boards. It's quite likely that you know about these fixes already, even though ALM-2s are relatively rare. I would be pleased if you could let me know if this information was any use. There were two separate problems, depending on the version of the Sun operating system: 1. Sun operating system version 3.5 ==================================== On exit from Emacs, a terminal attached to an ALM-2 line would hang for ever; you had to reboot the machine to fix it. I cured this by including the "s-bsd4-2.h" file, rather than "s-bsd4-3.h" in the "config.h" file, and remaking Emacs. We got the source from a Sun Users Group tape, so I had assumed that the "config.h" was suitable for all Suns! 2. Sun operating system version 4.0.1 ===================================== The problem again involved terminals hanging up on exit; this time they could be unblocked by typing CTRL/S and CTRL/Q, but it was still a nuisance. Here is a copy of some information I sent to Sun UK about the fix I made: The fault seems to occur when switching to or from raw mode when characters are being output. GNU Emacs uses the TIOCSETN ioctl, which does not delay until output is quiescent. Changing this in two places to TIOCSETP seems to fix the problem (note that these hang ups did not occur with OS 3.5, so I still think it is caused by a bug in the drivers). We are using GNU Emacs version 18.49; the changes described below may not be exactly correct for other versions, and indeed may already have been made in the States. The file 'sysdep.c' contains the terminal handling stuff. Here is the output from 'diff -c srcx/sysdep.c src/sysdep.c' (srcx/sysdep.c is the original, src/sysdep.c the modified version): *** srcx/sysdep.c Tue Oct 13 11:29:40 1987 --- src/sysdep.c Tue Jan 17 14:34:19 1989 *************** *** 734,740 **** --- 734,744 ---- SYS$QIOW (0, input_chan, IO$_SETMODE, &input_iosb, 0, 0, &sg.class, 12, 0, 0, 0, 0); #else + #ifdef SUNOS4_0 + ioctl (0, TIOCSETP, &sg); + #else ioctl (0, TIOCSETN, &sg); + #endif /* Not SUNOS4_0 */ #endif /* not VMS */ #ifdef F_SETFL *************** *** 921,927 **** --- 925,935 ---- SYS$QIOW (0, input_chan, IO$_SETMODE, &input_iosb, 0, 0, &old_gtty.class, 12, 0, 0, 0, 0); #else /* not VMS */ + #ifdef SUNOS4_0 + while (ioctl (0, TIOCSETP, &old_gtty) < 0 && errno == EINTR); + #else while (ioctl (0, TCSETAW, &old_gtty) < 0 && errno == EINTR); + #endif /* Not SUNOS4_0 */ #endif /* not VMS */ } ------ The two ioctls changed are in the #ifdef SUNOS4_0s. For cleanliness, I created a new header file (s-sunos4-0.h) which should be included in 'config.h' instead of 's-bsd4-2.h'. The new header defines the SUNOS4_0 flag and also sets up the special options needed to link GNU Emacs under OS 4.0 (it can't use dynamic linking because it dumps itself). As I said, it is likely that something of this sort has already been done by OS 4.0 users in the States; they may not have made the ioctl change, because there aren't many ALM-2s around. Here is the complete 's-sunos4-0.h': /* Definitions file for GNU Emacs running on SunOS 4.0.x Copyright (C) 1985, 1986 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU Emacs General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU Emacs, but only under the conditions described in the GNU Emacs General Public License. A copy of this license is supposed to have been given to you along with GNU Emacs so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* * Define symbols to identify the version of Unix this is. * Define all the symbols that apply correctly. */ #ifndef SUNOS4_0 #define SUNOS4_0 #endif /* SUNOS4_0 */ #include "s-bsd4-2.h" /* Special linking options for SunOS 4.0 */ #define LD_SWITCH_SYSTEM -X -Bstatic -e __start --------------- Richard Evans Topexpress Ltd. Poseidon House Castle Park Cambridge CB3 0RD UK Tel: 0223 462121 Fax: 0223 315057