From: "Albert Cahalan" <acahalan@gmail.com>
To: ray-gmail@madrabbit.org
Cc: "Jon Smirl" <jonsmirl@gmail.com>, "Greg KH" <greg@kroah.com>,
rmk+lkml@arm.linux.org.uk, alan@lxorguk.ukuu.org.uk,
efault@gmx.de, linux-kernel@vger.kernel.org
Subject: Re: Opinions on removing /proc/tty?
Date: Sun, 9 Jul 2006 15:26:19 -0400 [thread overview]
Message-ID: <787b0d920607091226sb1db56dg9c0267f6ae8e2dc7@mail.gmail.com> (raw)
In-Reply-To: <2c0942db0607091000m259c1ed5m960821eb5237c4b0@mail.gmail.com>
On 7/9/06, Ray Lee <madrabbit@gmail.com> wrote:
> On 7/9/06, Albert Cahalan <acahalan@gmail.com> wrote:
> > In any case, I'm NOT running a udevinfo program or linking
> > to a screwball library. Random failures are not OK.
>
> Complete agreement, but it seems like there's a third option here.
> We're talking about nothing more complicated than a table lookup here.
> Having a `udevinfo` invocation would indeed be overkill (and slower
> than just stating the entire /dev hierarchy, I'm sure), but
> Greg's/Jon's point that udev is the original authoritative source of
> the data remains.
>
> A simple solution would be for udev to just maintain a list in a flat
> file (e.g., /dev/.mappings) that could be read (very quickly) by ps
> upon startup. This could be yet another strategy somewhere in your
> list of heroic efforts to derive a /dev/ node :-).
>
> Having anyone other than udev try to maintain that mappings cache file
> is doomed to failure, as you already noted.
BSD just uses devname(3) in libc, which asks the kernel via
the kern.devname sysctl. So, /proc/sys/kern/devname for us.
This is essentially what /proc/tty/drivers is today, except
that FreeBSD standardized on a fully functional devfs.
Solaris uses _ttyname_dev(dev_t,buf,bufsize), also in libc.
This is horribly slow, involving a recursive search of
directories listed in the /etc/ttysrch file. The interface
is nice though. You get: ttyname, ttyname_r, _ttyname_dev.
Note that our glibc is often defective, not always upgraded,
and not even the only C library. I won't be relying on it
even if _ttyname_dev() or devname() gets implemented.
If you insist on bringing back the dead though...
I already have code, probably written in 1996 by Charles Blake.
Use /etc/psdevtab for the filename.
File format:
There are 16 tty major numbers (as of the Linux 1.1 kernel,
or thereabouts) with 256 minors each, and the names are 8
characters long. That makes for a 32 KiB file; procps will
verify the length. Major numbers are to be stored in the
following order:
2,3,4,5,19,20,22,23,24,25,32,33,46,47,48,49
The structure is thus like this:
char psdevtab[16][256][8]
Names should be zero-padded, not zero-terminated.
(seriously, a binary file with a tree structure is best)
next prev parent reply other threads:[~2006-07-09 19:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-09 5:30 Albert Cahalan
2006-07-09 14:04 ` Jon Smirl
2006-07-09 16:23 ` Albert Cahalan
2006-07-09 17:00 ` Ray Lee
2006-07-09 17:08 ` Ray Lee
2006-07-09 19:26 ` Albert Cahalan [this message]
2006-07-09 19:31 ` Russell King
2006-07-09 19:57 ` Albert Cahalan
2006-07-10 14:02 ` Jan Engelhardt
2006-07-10 15:06 ` Albert Cahalan
2006-07-10 22:17 ` Jan Engelhardt
2006-07-11 1:07 ` Albert Cahalan
2006-07-11 1:48 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2006-07-08 2:56 Jon Smirl
2006-07-08 5:30 ` Randy.Dunlap
[not found] ` <9e4733910607072256q65188526uc5cb706ec3ecbaee@mail.gmail.com>
2006-07-09 5:04 ` Randy.Dunlap
[not found] ` <9e4733910607082220v754a000ak7e75ae4042a5e595@mail.gmail.com>
2006-07-09 5:27 ` Randy.Dunlap
2006-07-09 10:07 ` Antonino A. Daplas
[not found] ` <9e4733910607090645l236f17f1sb9778f0fc6c6ca01@mail.gmail.com>
2006-07-09 17:35 ` Randy.Dunlap
2006-07-09 23:31 ` Antonino A. Daplas
[not found] ` <9e4733910607091744k273a7351l16abbcc6ff8c4bbd@mail.gmail.com>
2006-07-11 22:01 ` Greg KH
[not found] ` <9e4733910607111532s3fc2bb52q3f0247a9f2289d4e@mail.gmail.com>
2006-07-13 18:37 ` Greg KH
2006-07-08 7:40 ` Mike Galbraith
2006-07-08 14:12 ` Jon Smirl
2006-07-08 14:48 ` Alan Cox
2006-07-08 16:20 ` Jon Smirl
2006-07-08 17:20 ` Russell King
2006-07-11 22:03 ` Greg KH
2006-07-08 16:12 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=787b0d920607091226sb1db56dg9c0267f6ae8e2dc7@mail.gmail.com \
--to=acahalan@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=efault@gmx.de \
--cc=greg@kroah.com \
--cc=jonsmirl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ray-gmail@madrabbit.org \
--cc=rmk+lkml@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®