DEVICE
81,0
does not refer to blocks at all: together with TYPE
CHR
it indicates this device is a character device with major number 81 and minor number 0.
From /proc/devices
, you can see that character device major number 81 is associated with the video4linux
subsystem. The minor numbers are assigned by each subsystem as they see fit: in this case, the minor number is directly reflected in the device name /dev/video0
generated by udev
.
Classically, unix-like systems used the machine-friendly device numbers as the primary internal identifiers for devices, rather than human-friendly device names. The entire /dev
directory tree with its device nodes is basically a big look-up table that allows the kernel's filesystem drivers to convert device names to device numbers, much like the /etc/services
file allows you to use a port name like ssh
or ntp
instead of port numbers like 22 or 123, respectively. Device nodes can also have permissions, which is also very useful for restricting inappropriate access to device drivers.
When you run lsof
as a regular user, it may output information about your own processes only: a regular user has no business snooping on other users. Root privileges are required to see what other users' processes are doing.
sudo find / -type c -ls | grep 81, 2>/dev/null
to find all of the places where there might be an existing camera node and then lsof all of them. – rotten May 19 '23 at 15:29mknod
the device, connect to it, then spin off another process that deletes the node from the file system, but it still hangs on to it in the original thread. Surely there is a way to list open files that have been deleted from the file system? (And normally one wouldn't expect to find too many of them - especially after a reboot.) – rotten May 22 '23 at 13:50/proc/*/files
or havelsof
do it for you. One would not normally ever expect that for a device file. – Gilles 'SO- stop being evil' May 22 '23 at 17:13