Tiny Core Linux

Off-Topic => Off-Topic - Tiny Core Lounge => Topic started by: marquitico on July 19, 2011, 05:45:50 PM

Title: Major/minor numbers [Solved]
Post by: marquitico 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.
Title: Re: Major/minor numbers
Post by: maro 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.
Title: Re: Major/minor numbers
Post by: marquitico on July 19, 2011, 11:42:29 PM
Thank you so much!