I have a kernel module that uses shared memory to exchange data with a userspace app. I can use C to implement the userspace app and map that shared memory without any problem.
Now, when I try to use Python it always throws the error msg :
ValueError: cannot mmap an empty file
Does anyone know how to correctly handle this mapping?
Sample code:
import mmap
import os
filepath="/proc/file"
fd = os.open(filepath, os.O_RDONLY)
mmap_object = mmap.mmap(fd,0, mmap.MAP_SHARED,mmap.ACCESS_READ)
txt=mmap_object.read()