mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
anonymous inode: move doc to readme
This commit is contained in:
33
README.adoc
33
README.adoc
@@ -3101,6 +3101,37 @@ Sources:
|
||||
|
||||
Bibliography: https://stackoverflow.com/questions/5970595/how-to-create-a-device-node-from-the-init-module-code-of-a-linux-kernel-module/45531867#45531867
|
||||
|
||||
==== Anonymous inode
|
||||
|
||||
In guest:
|
||||
|
||||
....
|
||||
/anonymous_inode.sh
|
||||
echo $?
|
||||
....
|
||||
|
||||
Outcome: the test passes:
|
||||
|
||||
....
|
||||
0
|
||||
....
|
||||
|
||||
Sources:
|
||||
|
||||
* link:kernel_module/anonymous_inode.c[]
|
||||
* link:kernel_module/anonymous_inode.h[]
|
||||
* link:kernel_module/user/anonymous_inode.c[]
|
||||
* link:rootfs_overlay/anonymous_inode.sh[]
|
||||
|
||||
This example:
|
||||
|
||||
* gets an anonymous inode via `ioctl` from a debugfs entry `anon_inode_getfd` from a debugfs file
|
||||
* read jiffies from that inode
|
||||
|
||||
Anonymous inodes allow getting multiple file descriptors from a single filesystem entry, which reduces namespace pollution compared to creating multiple device files.
|
||||
|
||||
Bibliography: https://stackoverflow.com/questions/4508998/what-is-an-anonymous-inode-in-linux
|
||||
|
||||
=== Kernel panic and oops
|
||||
|
||||
To test out kernel panics and oops in controlled circumstances, try out the modules:
|
||||
@@ -7734,7 +7765,7 @@ We are slowly automating testable guest tests with:
|
||||
./run -F '/test_all.sh;/poweroff.out' | grep lkmc_test
|
||||
....
|
||||
|
||||
which outputs to stdout `lkmc_test_pass` or `lkmc_test_fail` to stdout, which we can grep from host to automate testing.
|
||||
which outputs `lkmc_test_pass` or `lkmc_test_fail`.
|
||||
|
||||
Source: link:rootfs_overlay/test_all.sh[].
|
||||
|
||||
|
||||
Reference in New Issue
Block a user