Why is there no munmap callback in struct file_operation?

I am working on a Linux kernel module that shares a chunk of memory with user applications through syscall mmap. The module works well with the mmap callback defined in struct file_operations, which informs the module when syscall is called.

However, the problem occurs when user applications want to stop sharing through syscall munmap. There is no munmap callback or something similar similar to working in struct file_operations. Therefore, I have to do another ioctl to tell the kernel module that the partition has been canceled, which is inconvenient and inconvenient.

While searching for a solution, I discovered that the munmap callback was once defined. But it was removed when the kernel version was about 2.4 or more times.

Can someone tell me why the munmap callback has been removed or is there any alternative approach to inform the kernel module when calling the syscall call?

+4
source share
2 answers

After some searching, I finally came up with the answers.

The function I need lies in vm_operations_struct. A callback will be closed if syscall munmap () succeeds, and I can use this function pointer to tell my kernel module what just happened.

, , mmap , vm_area, , .

, " Linux Linux", 15.

.

+4

munmap() , , .

mmap() , .

+1

All Articles