Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2001 19:46:22 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        Brian Somers <brian@Awfulhak.org>
Cc:        Peter Wemm <peter@wemm.org>, David Wolfskill <david@catwhisker.org>, current@FreeBSD.ORG
Subject:   Re: Huh??!? xterm: Error 14, errno 2: No such file or directory 
Message-ID:  <35900.989948782@critter>
In-Reply-To: Your message of "Tue, 15 May 2001 17:40:27 BST." <200105151640.f4FGeR576715@hak.lan.Awfulhak.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

Go ahead!


In message <200105151640.f4FGeR576715@hak.lan.Awfulhak.org>, Brian Somers writes:
>This makes xterm work again.  Any objections to a commit ?
>
>> David Wolfskill wrote:
>> 
>> > Built -CURRENT & rebooted after mergemaster as usual, and some X
>> > applications (xbattbar; xlockmore; oclock) work OK, but no xterm.  At
>> > least, not from X (XF86-4.0.3).  I tried using Ctl-Alt-F2 to get to
>> > a non-X login, logged in , set DISPLAY to m147:0.0, issued "xterm &",
>> > and got an xterm OK.
>> 
>> Known problem.  phk changed the semantics of /dev/tty in the most recent
>> commits.  Traditional behavior for a process *without* a controlling tty
>> when it opens /dev/tty is to get ENXIO.
>> 
>> Formerly, ctty_open() returns ENXIO:
>> cttyopen(dev, flag, mode, p)
>> {
>>         struct vnode *ttyvp = cttyvp(p);
>> 
>>         if (ttyvp == NULL)
>>                 return (ENXIO);
>> ...
>> 
>> 
>> and now:
>> ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
>> {
>>         struct vnode *vp;
>> 
>>         if (*dev != NODEV)
>>                 return;
>>         if (strcmp(name, "tty"))
>>                 return;
>>         vp = cttyvp(curproc);
>>         if (vp == NULL)
>>                 return;  <<< here, leads to ENOENT.
>>         *dev = vp->v_rdev;
>> }
>> 
>> There used to be a device for the ctty.  We still maintain it for the
>> non-devfs case.  The following hack may work, I have not tested or even
>> compiled it:
>> 
>> Index: kern/tty_tty.c
>> ===================================================================
>> RCS file: /home/ncvs/src/sys/kern/tty_tty.c,v
>> retrieving revision 1.34
>> diff -u -r1.34 tty_tty.c
>> --- tty_tty.c	2001/05/14 08:22:56	1.34
>> +++ tty_tty.c	2001/05/15 08:30:17
>> @@ -177,6 +177,8 @@
>>  
>>  static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev));
>>  
>> +static dev_t ctty;
>> +
>>  static void
>>  ctty_clone(void *arg, char *name, int namelen, dev_t *dev)
>>  {
>> @@ -187,9 +189,11 @@
>>  	if (strcmp(name, "tty"))
>>  		return;
>>  	vp = cttyvp(curproc);
>> -	if (vp == NULL)
>> -		return;
>> -	*dev = vp->v_rdev;
>> +	if (vp == NULL) {
>> +		if (ctty)
>> +			*dev = ctty;
>> +	} else
>> +		*dev = vp->v_rdev;
>>  }
>>  
>>  
>> @@ -201,6 +205,7 @@
>>  
>>  	if (devfs_present) {
>>  		EVENTHANDLER_REGISTER(dev_clone, ctty_clone, 0, 1000);
>> +		ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty");
>>  	} else {
>>  		make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "tty");
>>  	}
>> 
>> This hack recreates a /dev/ctty hook that works the "old way", and makes
>> /dev/tty switch through to that one instead.  This is evil and is probably
>> even more broken than before, but I think it will work.
>> 
>> The alternative is to edit the XFree86 xterm source and rebuild it.
>> look for xc/programs/xterm/main.c where it opens /dev/tty and then
>> checks an inclusive list of errno's, including ENXIO and ENODEV etc.
>> Add ENOENT to the list of 'acceptable' errors.
>> 
>> Incidently, the xterm binary is broken, it does not use libutil/openpty().
>> 
>> Cheers,
>> -Peter
>> --
>> Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
>> "All of this is for nothing if we don't go to the stars" - JMS/B5
>> 
>> 
>> To Unsubscribe: send mail to majordomo@FreeBSD.org
>> with "unsubscribe freebsd-current" in the body of the message
>> 
>
>-- 
>Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
>      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
>Don't _EVER_ lose your sense of humour !
>
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-current" in the body of the message
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35900.989948782>