So i was given this C assignment in which i have to to reproduce the ls command. Everything is going fine but i have this one problem that i can't manage to understand.
When using ls -l on /dev the output gives me something like this :
"ls -l /dev"
...
dr-xr-xr-x 1 root wheel 0 Dec 17 15:55 fd
crw-r--r-- 1 root wheel 13, 0 Dec 17 15:55 fsevents
crw-rw-rw- 1 root wheel 21, 17 Dec 17 15:55 io8log <<notice these lines
cr--r--r-- 1 root wheel 21, 14 Dec 17 15:55 io8logmt <<notice these lines
crw-rw-rw- 1 root wheel 21, 15 Dec 17 22:09 io8logtemp <<notice these lines
crw------- 1 root wheel 6, 0 Dec 17 15:55 klog
...
but then :
"/bin/ls -l /dev":
...
dr-xr-xr-x 1 root wheel 0 Dec 17 15:55 fd
crw-r--r-- 1 root wheel 13, 0 Dec 17 15:55 fsevents
crw-rw-rw- 1 root wheel 21, 15 Dec 17 15:55 io8log << see how the minor has changed?
cr--r--r-- 1 root wheel 21, 16 Dec 17 15:55 io8logmt << same here
crw-rw-rw- 1 root wheel 21, 17 Dec 17 22:35 io8logtemp << and here too
crw------- 1 root wheel 6, 0 Dec 17 15:55 klog
...
How come the minor number is changed for these three lines? Aren't ls and /bin/ls the same? Isn't ls just an "alias" for /bin/ls or does this add/remove "options" to the command?
Also (even though this is not the exact same problem), how come minor numbers for these files comes out in hex? It doesn't even match the minor number i'm getting from them
"ls -l /dev":
crw-rw-rw- 1 root wheel 33, 0x00000ac7 Dec 17 15:55 autofs_homedirmounter
crw-rw-rw- 1 root wheel 32, 0x00000ac7 Dec 17 15:55 autofs_notrigger
crw-rw-rw- 1 root wheel 31, 0x00001581 Dec 17 15:55 autofs_nowait
mine :
crw-rw-rw- 1 root wheel 33, 2722 Dec 17 15:55 autofs_homedirmounter
crw-rw-rw- 1 root wheel 32, 2722 Dec 17 15:55 autofs_notrigger
crw-rw-rw- 1 root wheel 31, 5198 Dec 17 15:55 autofs_nowait
all the other minor/major numbers correspond when calling either ls, /bin/ls or my program just these lines are different.
If anyone has hints, thanks a lot :)
edit : This is the result of the command by zwol :
/dev/io8log 1500000f
/dev/io8logmt 15000010
/dev/io8logtemp 15000011
/dev/klog 6000000
/dev/autofs 16000000
/dev/autofs_control 22000000
/dev/autofs_homedirmounter 21000ae5
/dev/autofs_notrigger 20000ae5
/dev/autofs_nowait 1f00174b
when calling it twice the numbers varies for all io8 dirs and autofs dirs (except autofs_control) which seems to match the behaviour of ls