[comp.sys.pyramid] xterm problem with ioctl

wcm@geac.com (W Christopher Martin) (04/12/91)

I've compiled the X11R4 package under the ucb universe on our Pyramid
(att uname -a = "OSx120M pyrogy 5.1a-900725 0409e MIS-2/02") and
everything works great except for xterm.  It complains about
"Error 16, errno 25: Inappropriate I/O control operation" which I've
tracked down to the TIOCGETC in main.c.

I tried a simple test program which did the same ioctl on a pseudo-tty
and it worked fine, I believe there must be a problem with the way
xterm is opening the pseudo-tty.  Before I start trying to dig any
further into xterm, I felt it would be better to check to see if
anyone else could shed some light on the problem.

Patches to make xterm work on the Pyramid would be even better.

Thanks,
wcm
-- 
W. Christopher Martin  <wcm@geac.com>

rick@ptcburp.ptcbu.oz.au (Rick Stevenson) (04/12/91)

wcm@geac.com (W Christopher Martin) writes:

>I've compiled the X11R4 package under the ucb universe on our Pyramid
>(att uname -a = "OSx120M pyrogy 5.1a-900725 0409e MIS-2/02") and
>everything works great except for xterm.  It complains about
>"Error 16, errno 25: Inappropriate I/O control operation" which I've
>tracked down to the TIOCGETC in main.c.

The only changes I had to make to R4 xterm to get it to run on our
machine (OS equivalent to OSx5.1) were as follows:

*** main.c-	Mon Apr  9 08:30:54 1990
--- main.c	Fri Oct 19 11:07:27 1990
***************
*** 115,120
  #define ttyslot() 1
  #endif /* apollo */
  
  #include <utmp.h>
  #ifdef LASTLOG
  #include <lastlog.h>

--- 115,125 -----
  #define ttyslot() 1
  #endif /* apollo */
  
+ #ifdef pyr
+ #define UTMP_FILENAME	"/etc/.ucbutmp"
+ #define WTMP_FILENAME	"/etc/.ucbwtmp"
+ #endif
+ 
  #include <utmp.h>
  #ifdef LASTLOG
  #include <lastlog.h>
***************
*** 1721,1727
  #endif
  		ioctl(0, TIOCSPGRP, (char *)&pgrp);
  		setpgrp(0,0);
! 		close(open(ttydev, O_WRONLY, 0));
  		setpgrp (0, pgrp);
  #endif /* USE_SYSV_PGRP */
  

--- 1726,1737 -----
  #endif
  		ioctl(0, TIOCSPGRP, (char *)&pgrp);
  		setpgrp(0,0);
! 		/*
! 		 * This open was previously O_WRONLY which caused problems
! 		 * because of OSx /dev/tty hole protection.
! 		 * Rick Stevenson, APRIL 90.
! 		 */
! 		close(open(ttydev, O_RDWR, 0));
  		setpgrp (0, pgrp);
  #endif /* USE_SYSV_PGRP */
  
The utmp/wtmp stuff stops ugly things happening if you invoke xterm from the ATT
universe (like corruption of the ATT utmp/wtmpfiles). From memory I think the
other mod fixes a problem with access to /dev/tty being denied. I don't recall
the symptoms of this being exactly as you describe. Mail me if this doesn't
help.

Rick.
--
Rick Stevenson
Pyramid Technology Corporation			+61 75 522475 FAX
Research Park, Bond University			+61 75 950249 VOICE
Gold Coast, Q 4229, AUSTRALIA			rick@ptcburp.oz.au

wcm@geac.com (W Christopher Martin) (04/14/91)

Thanks to all those who offered suggestions on my problem.  The solution
was to remove:

#define DefaultCCOptions	-q

which I had put in my config file on the advise of someone else.  This
didn't seem to have any adverse effect on anything except xterm, but
after removing it and rebuilding all, everything now works, including xterm.

I did use the two changes which were suggested by rick@ptcburp.oz.au
to avoid potential problems with utmp/wtmp.

Thanks again,
wcm
-- 
W. Christopher Martin  <wcm@geac.com>