*BSD News Article 28519


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!merlin!mel.dit.csiro.au!its.csiro.au!dmssyd.syd.dms.CSIRO.AU!metro!news.cs.su.oz.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!EU.net!sun4nl!news.nic.surfnet.nl!utciva.civ.utwente.nl!infnews.cs.utwente.nl!olah
From: olah@cs.utwente.nl (Andras Olah)
Subject: Re: [FreeBSD] tcsh can't access tty
Message-ID: <1994Mar18.163305@cs.utwente.nl>
Sender: usenet@cs.utwente.nl
Nntp-Posting-Host: utis156.cs.utwente.nl
Organization: Univ. of Twente, Dept. of Comp. Sci.
References: <2m936a$gq0@agate.berkeley.edu> <COGSWELL.94Mar17125540@creampie.cs.uoregon.edu>
Date: Fri, 18 Mar 1994 15:33:05 GMT
Lines: 66

Bryce,

In article <COGSWELL.94Mar17125540@creampie.cs.uoregon.edu>, cogswell@creampie.cs.uoregon.edu (Bryce Howard Cogswell) writes:
|> Get a copy of tcsh-6.04 (this is what I started with, although the exact
|> version probably isn't critical).
|> In the file "tc.disc.c" there is a function "setdisc" that sets the
|> line discipline.  The problem appears to be that FreeBSD doesn't support
|> NTTYDISC, and the setdisc function doesn't handle this case and has an
|> undefined return value.  The last block of conditionally compiled code 
|> in this function should be changed to:
|> 
|> #ifndef HAVE_DISC
|> # if defined(TIOCGETD) && defined(NTTYDISC)
|>     if (ioctl(f, TIOCGETD, (ioctl_t) & oldisc) == 0) {
|>         if (oldisc != NTTYDISC) {
|>             int     ldisc = NTTYDISC;
|> 
|>             if (ioctl(f, TIOCSETD, (ioctl_t) & ldisc) != 0)
|>                 return (-1);
|>             add_discipline = 1;
|>         }
|>         else
|>             oldisc = -1;
|>         return (0);
|>     }
|>     else
|>         return (-1);
|> # else					<<<< NEW !!!
|>     return (0);				<<<< CODE !!!
|> # endif /* TIOCGETD && NTTYDISC */
|> #endif  /* !HAVE_DISC */
|> 
|> The only thing I added was a return value of zero where none was supplied
|> prior.  I've been using this fix for about a month now with no problems.
|> 
|> -- Bryce


The hack you describe IS included into the source distribution of tcsh in the
packages directory.  I was looking at it because I had (still have) the very
same problem with tcsh.  The problem is that the new code you mention is not
compiled into the code, because TIOCGETD and NTTYDISC are indeed defined.  I
placed prints into the code, and it appears that the terminal is in the
OTTYDISC (=0) discipline and does't let itself to be set into NTTYDISC (the
TIOCSETD ioctl fails).  Because I don't know how this tty stuff works I didn't
dug any further.

Please, help me and others if you can.  I asked the very same question about a
month ago but I got no answers that helped.  Is there some error in the
standard configuration files for tcsh or is it something else?  Further
pecularities: after exiting from X and making a su to shut down, I get the
same error from csh which works OK before that.  I get this error only if I
use fvwm in X, if I use twm then it does not happen.  (Seems like real black
magic to me ;-)

I'm using FreeBSD 1.0.2 with pccons, no other changes to the generic kernel
except ethernet and scsi is not configured.

Looking forward to any advice,

-- 
 
  Andras Olah                    	olah@cs.utwente.nl
  Univerity of Twente		 	tfx. +31 53 333815
  Tele-Informatics & Open Systems	tel. +31 53 892819
  P.O. Box 217, 7500 AE Enschede,	the Netherlands