简体   繁体   中英

How can I map a memory of bytes from a kernel module to user space app?

I would like to declare an array in kernel module and to access it within a userspace app. how can I do it?

How do I memory map it for using via userspace so it can be used by a user?

You will most likely need to implement a character device. Then in your instance of struct file_operations implement the mmap function .

I guess you have everything here: http://www.scs.ch/~frey/linux/memorymap.html

First result on Google, by the way.

Linux Device Driver 3th Chapter 15. It talks about mmap. Chapter 3 and 6 talk about char devices.

也许用户空间I / O系统会为您提供帮助: https : //www.osadl.org/?id=321

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM