Re: HOWTO use udev to manage /dev

From: Johannes Stezenbach
Date: Fri Feb 20 2004 - 14:43:42 EST


On Fri, Feb 20, 2004 at 01:52:37AM +0100, Andries Brouwer wrote:
> 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.

dietlibc actually uses readlink from /proc/sef/fd/. The code
you quote is used only if one #undef SLASH_PROC_OK in dietfeatures.h.
Few people will use this, and those that do probably have a
good reason.

Johannes
-
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/