Re: user space way to determine "region" of allocated minors?

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

 



On Mon, 3 Aug 2009, Mulyadi Santosa wrote:

> On Mon, Aug 3, 2009 at 3:45 AM, Robert P. J. Day<rpjday@xxxxxxxxxxxxxx> wrote:
> >
> >  i'm guessing there's no way to do this but, if you list the file
> > /proc/devices, you see only the character and block devices and the
> > major number corresponding to them:
> >
> > Character devices:
> >  1 mem
> >  4 /dev/vc/0
> >  4 tty
> >  4 ttyS
> >  5 /dev/tty
> >  5 /dev/console
> >  5 /dev/ptmx
> >  7 vcs
> >  10 misc
> >  13 input
> >  14 sound
> >  21 sg
> >  29 fb
> >  ... etc etc ...
> >
> > is there any way, from user space, to see the *minor* number region
> > corresponding to those entries?
>
> How about "ls"? e.g:
>
> $ ls -li /dev/vcs*
> 4472 crw-rw---- 1 vcsa tty 7,   0 2009-08-01 09:56 /dev/vcs
> 8296 crw-rw---- 1 vcsa tty 7,   2 2009-08-01 09:56 /dev/vcs2
>
> 7 is major number, 0 and 2 are minor number of vcs and vcs2 respectively...

  no, that shows you the subsequent *user space* device file creation
results.  to see what i mean, take a look at LDD3,
http://lwn.net/Kernel/LDD3/, chapter 3.

  that chapter explains how a device driver can register its major and
minor numbers with, say, alloc_chrdev_region(), but that operation
does nothing about creating the appropriate the userspace /dev files
-- that has to be done as a separate operation in userspace, and it's
assumed you *know* what those minor numbers are.

  i'm asking if there's a way to see the results of that kernel space
alloc_chrdev_region() call in terms of minor device numbers,
information that is not provided in /proc/devices.

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
"Kernel Newbie Corner" column @ linux.com:          http://cli.gs/WG6WYX
========================================================================

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux