mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Albert Cahalan" <acahalan@gmail.com>
To: "Jon Smirl" <jonsmirl@gmail.com>
Cc: "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 12:23:25 -0400	[thread overview]
Message-ID: <787b0d920607090923p65c417f2v71c8e72bf786f995@mail.gmail.com> (raw)
In-Reply-To: <9e4733910607090704r68602194h3d2a1a91a4909984@mail.gmail.com>

On 7/9/06, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/9/06, Albert Cahalan <acahalan@gmail.com> wrote:
> > Jon Smirl writes:
> > > On 7/8/06, Mike Galbraith <efault@gmx.de> wrote:
> > >> On Fri, 2006-07-07 at 22:56 -0400, Jon Smirl wrote:

> > >>> Does anyone have a problem with deleting /proc/tty if
> > >>> ldisc enum support is added to sysfs?
> > >>
> > >> ps uses /proc/tty/drivers, so some coordination would be needed.
> > >
> > > Greg, I just looked at the source for ps and it has a bunch
> > > of fixed code for turning major/minor into /dev/name.  Isn't
> > > that something udevinfo should be doing? But looking at the
> > > help for udevinfo I don't see any way to turn a major/minor
> > > into /dev/name. The altermative seems to be search /dev
> > > looking for the right device node.
> >
> > By far, the best thing for procps (ps, top, etc.) would
> > be /proc/*/tty links. Code that, give everybody a year
> > to upgrade, and then... maybe.
> >
> > There is no way I'm going to have the procps run a "udevinfo"
> > program, and I very much dislike relying on oddball libraries.
> > Reliability and performance matter; this isn't some GNOME/KDE
> > thing that can break just because 1 of 200 libraries changed.
> >
> > In order, the procps code tries:
> >
> > 1. /proc/*/tty symlink (effectively commented out)
> Doesn't existing the the current kernel.

Sure. It was planned, and there once was a half-written patch.
Right now, procps looks for Linux 2.7.0 before even trying.
(at the time, it was looking like the feature wouldn't make it
into the 2.6.xx series and that 2.7.xx would exist)

> > 2. /proc/tty/drivers
> This info can be wrong due to udev renames.  For example tty1 vs tty/1
> The info in /proc/tty/drivers describes hardware not processes, it
> belongs in sysfs, not /proc.

The only cost is a wasted stat() call to verify the name.
IMHO, using non-standard names is stupid anyway. The people
who do this are probably quite rare. As long as you stick to
the standard device names or devfs, this method is very fast.

(all of these methods will stat() the file to verify it)

> > 3. /proc/*/fd/2 symlink
> Working in the current kernel
>
> > 4. hard-coded guess
> This will be wrong because of udev renames. For example tty1 vs tty/1

That would be fucked up. You need a /dev/tty device.
You need that device even on non-Linux systems.
Also, your abbreviated tty names would start with "/", making
many tools interpret them as absolute paths.

See? Lots of badness happens if you mess with device names.

> > 5. /proc/*/fd/255 symlink
> Working in the current kernel
>
> > 6. "?"
> Always good
>
> > Long ago, procps would search /dev for the mapping. This was
> > too slow to be done directly when ps ran, so a binary file in
> > /etc was used to cache the data. Keeping that file updated
> > was a major problem.
>
> This is what udev does, it maintains the mapping between devices and
> names. Udevinfo is how you query the database. /etc/udev is where you
> control how the device numbers are mapped into names.

You'd just better not choose screwball names.

> Now we have a good example of the impact of pushing something (udev)
> into user space and not shipping the binary as part of the kernel
> tree. What is the API for converting a device node number to a name?

I suggest using devfs.  :-)  The /proc/tty/drivers names
are correct on devfs systems.

We have a Documentation/devices.txt file in the kernel source.
Nearly all of the time, this alone should do the job.

Note that procps needs to handle a tty that udev doesn't
know about, even on a system running udev. It's best to
have everything in /dev with devices.txt names, but somebody
might create a chroot environment somewhere else.
Only the symlinks in /proc can provide this.

In any case, I'm NOT running a udevinfo program or linking
to a screwball library. Random failures are not OK.

  reply	other threads:[~2006-07-09 16:23 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 [this message]
2006-07-09 17:00     ` Ray Lee
2006-07-09 17:08       ` Ray Lee
2006-07-09 19:26       ` Albert Cahalan
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=787b0d920607090923p65c417f2v71c8e72bf786f995@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=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®