The mmap file operation
The kernel mmap function is part of the struct file_operations structure, which is executed when the user executes the mmap(2) system call used to map physical memory into a user virtual address. The kernel translates any access to that mapped region of memory through the usual pointer dereferences into a file operation. It is even possible to map device physical memory directly to the user space (see /dev/mem). Essentially, writing to memory becomes like writing into a file. It is just a more convenient way of calling write().
Normally, user space processes cannot access device memory directly for security purposes. Therefore, user space processes use the mmap() system call to ask the kernel to map the device into ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access