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 - [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> "All of this is for nothing if we don't go to the stars" - JMS/B5
>
>
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
>
--
Brian <[EMAIL PROTECTED]> <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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message