From owner-freebsd-current Tue May 15 1:34:32 2001 Delivered-To: freebsd-current@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [65.0.135.147]) by hub.freebsd.org (Postfix) with ESMTP id D0F3537B42C; Tue, 15 May 2001 01:34:27 -0700 (PDT) (envelope-from peter@wemm.org) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f4F8YRM50164; Tue, 15 May 2001 01:34:27 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id A1AAA3811; Tue, 15 May 2001 01:34:27 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: David Wolfskill Cc: current@FreeBSD.ORG, phk@FreeBSD.ORG Subject: Re: Huh??!? xterm: Error 14, errno 2: No such file or directory In-Reply-To: <200105142019.f4EKJGA75484@bunrab.catwhisker.org> Date: Tue, 15 May 2001 01:34:27 -0700 From: Peter Wemm Message-Id: <20010515083427.A1AAA3811@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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