Off-Topic > Off-Topic - Tiny Core Lounge

Major/minor numbers [Solved]

(1/1)

marquitico:
If I use ls -l on a device node to produce this output:


--- Code: ---brw-r----- 1 root    root   8,  33 1995-04-29 06:34 sdc1
--- End code ---

are the major/minor #s (8, 33) displayed in dec or in hex?

Thank you.

maro:
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: ---...
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 {
...

--- End code ---

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

marquitico:
Thank you so much!

Navigation

[0] Message Index

Go to full version