Re: HOWTO use udev to manage /dev

From: Andries Brouwer
Date: Thu Feb 19 2004 - 20:12:51 EST


On Thu, Feb 19, 2004 at 08:21:25PM +0000, James Simmons wrote:

> Okay. If I change the major number of serial ttys inside the kernel
> of course udev would properly handle this. Now the question is would this
> break userland applications using the serial port?

Yes, a few of them.
Ordinarily, userland software uses pathnames in /dev.
But some software knows too much.

In dietlibc-0.20 one can read:

char *ttyname(int fd) {
...
if (S_ISCHR(s.st_mode)) {
n=minor(s.st_rdev);
switch (major(s.st_rdev)) {
case 4:
...
case 2:
...
case 136:
case 137:
case 138:
case 139:
...
}

This code knows about the actual values of majors.
There are lots of examples like this.

For stable use of Linux one must preserve the 16-bit legacy area.

On the other hand, if the goal is to find and eradicate all such
ugly uses of explicit device numbers, Linus' idea to make it all
random will certainly help.
(But a big grep for st_rdev might be more efficient.)

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/