mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Improve file operation intro
Done while answering: https://stackoverflow.com/questions/3290590/what-options-do-we-have-for-communication-between-a-user-program-and-a-linux-ker/51206012#51206012
This commit is contained in:
@@ -3687,12 +3687,13 @@ 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
|
||||
|
||||
|
||||
=== Pseudo files
|
||||
|
||||
==== File operations
|
||||
|
||||
File operations are the main method of userland driver communication. `struct file_operations` determines what the kernel will do on filesystem system calls of <<pseudo-filesystems>>:
|
||||
File operations are the main method of userland driver communication. `struct file_operations` determines what the kernel will do on filesystem system calls of <<pseudo-filesystems>>.
|
||||
|
||||
This example illustrates the most basic system calls: `open`, `read`, `write`, `close` and `lseek`:
|
||||
|
||||
....
|
||||
/fops.sh
|
||||
@@ -3919,7 +3920,7 @@ This example gets an anonymous inode via <<ioctl>> from a debugfs entry by using
|
||||
|
||||
Reads to that inode return the sequence: `1`, `10`, `100`, ... `10000000`, `1`, `100`, ...
|
||||
|
||||
Bibliography: https://stackoverflow.com/questions/4508998/what-is-an-anonymous-inode-in-linux
|
||||
Bibliography: https://stackoverflow.com/questions/4508998/what-is-an-anonymous-inode-in-linux/44388030#44388030
|
||||
|
||||
==== netlink sockets
|
||||
|
||||
|
||||
Reference in New Issue
Block a user