Kernel module for /proc

后端 未结 3 501
梦谈多话
梦谈多话 2021-01-23 02:16

How to write a kernel module that creates a directory in /proc named mymod and a file in it name is mymodfile. This file should accept a number ranged from 1 to 3 when written i

相关标签:
3条回答
  • 2021-01-23 02:33

    What you're looking for is the Linux Kernel Module Programming Guide, specifically the section on the /proc filesystem, which has well documented examples of how to add new entries.

    0 讨论(0)
  • 2021-01-23 02:47

    This might be easier to do using sysfs. Sysfs was designed with these sorts of operations in mind, and has simple functions for creating directories and virtual files and callbacks for read and write operations to those files.

    0 讨论(0)
  • 2021-01-23 02:57

    There is an article about this in a french magazine called "Gnu/Linux magazine" this month.

    I don't have my bookmarks here, but theses links look ok:

    http://www.linuxhq.com/lkprogram.html

    http://tldp.org/HOWTO/Module-HOWTO/x839.html

    http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

    0 讨论(0)
提交回复
热议问题