WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Major/minor numbers [Solved]  (Read 2307 times)

Offline marquitico

  • Newbie
  • *
  • Posts: 41
Major/minor numbers [Solved]
« on: July 19, 2011, 05:45:50 PM »
If I use ls -l on a device node to produce this output:

Code: [Select]
brw-r----- 1 root    root   8,  33 1995-04-29 06:34 sdc1
are the major/minor #s (8, 33) displayed in dec or in hex?

Thank you.
« Last Edit: July 19, 2011, 11:43:53 PM by marquitico »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Major/minor numbers
« Reply #1 on: July 19, 2011, 06:40:44 PM »
I was pretty certain that the answer would be "decimal", but I nevertheless went back to check out the BusyBox source code for the 'ls' applet (file: 'coreutils/ls.c', function: 'list_single()') where the following code snippet can be found:
Code: [Select]
...
if (all_fmt & (LIST_SIZE /*|LIST_DEV*/ )) {
if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) {
column += printf("%4u, %3u ",
(int) major(dn->dstat.st_rdev),
(int) minor(dn->dstat.st_rdev));
} else {
...

So it is quite obvious from the use of the '%4u' and '%3u' that both values are formatted as unsigned (decimal) integers.

Offline marquitico

  • Newbie
  • *
  • Posts: 41
Re: Major/minor numbers
« Reply #2 on: July 19, 2011, 11:42:29 PM »
Thank you so much!