Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 May 2001 14:38:25 +0200
From:      Poul-Henning Kamp <phk@freebsd.org>
To:        arch@freebsd.org, current@freebsd.org
Subject:   /dev/tty and device cloning.
Message-ID:  <8074.989757505@critter>

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

/dev/tty is as we all know quite a hack: it is a variant symlink
is disguise.

I have create a patch which cleans up the way /dev/tty works using
the DEVFS cloning mechanism, and I would like to get feedback on it.

http://phk.freebsd.dk/patch/devtty.patch

20010513        devtty.patch

        This patch slightly changes the way device cloning works.
        After the cloners have been called we try to find the match
        not by name but by the dev_t the successfull cloner gave us.

        This allows "cloning by a different name" activities.

        The patch to kern/tty_tty.c exploits this feature to remove
        the the magic and bogus /dev/tty device, and instead /dev/tty
        by clone-magic points at the process' controlling terminal.

        (The patch also contains a few cleanups)

        The following difference results:

        Without this patch:

                critter phk> tty
                /dev/ttypd
                critter phk> ls -li /dev/ttypd /dev/tty
                 12 crw-rw-rw-  1 root  wheel    1,   0 13 Maj 14:22 /dev/tty
                109 crw--w----  1 phk   tty      5,  13 13 Maj 14:28 /dev/ttypd

        With this patch:

                syv# tty
                /dev/ttyp0
                syv# ls -li /dev/ttyp0 /dev/tty
                87 crw--w----  1 root  tty    5,   0 May 13 12:27 /dev/tty
                87 crw--w----  1 root  tty    5,   0 May 13 12:27 /dev/ttyp0


-- 
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-arch" in the body of the message




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