[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: char-major-6



On Wed, Aug 14, 2002 at 11:41:29AM -0400, Hall Stevenson wrote:
> > So, let's see what char-major-6 is:
> >
> > $ ls -l /dev | grep " 6,"
> > crw-rw----    1 root     lp         6,   0 Nov 30  2000 lp0
> > crw-rw----    1 root     lp         6,   1 Nov 30  2000 lp1
> > crw-rw----    1 root     lp         6,   2 Nov 30  2000 lp2
> > crw-rw----    1 root     lp         6,   0 Nov 30  2000 par0
> > crw-rw----    1 root     lp         6,   1 Nov 30  2000 par1
> > crw-rw----    1 root     lp         6,   2 Nov 30  2000 par2
> 
> So that's what the "-x" number value corresponds to ??

Yep!  Devices are divided into two general types, character and
block, which is indicated by the first letter in the ls -l output.
The two numbers just before the date are the major and minor device
ID.  So, e.g., /dev/lp0 is a character device with major device ID 6
and minor ID 0.

crw-rw----    1 root     lp         6,   0 Nov 30  2000 lp0
^                                   ^    ^
+- Character mode device            |    +- Minor 0
                                    +------ Major 6

And that's where the "char-major-6" comes from.  The mode and major
device tell the kernel which driver/module to use to handle the
device's I/O.  The minor ID is used by the driver so that it knows
which exact device it's talking to.  (Note in the listing above that
lp0 and par0 have the same minor ID.  This makes them equivalent,
much like hardlinking a normal file to multiple names.)

-- 
When we reduce our own liberties to stop terrorism, the terrorists
have already won. - reverius

Innocence is no protection when governments go bad. - Tom Swiss



Reply to: