0

is it possible that i use FILE I/O instead character device driver?

in my kernel module code i used character device driver source code

(ex. alloc_chrdev_region()....) it because i want to read any number from specific files and process them in module. but when i tried first time, i used FILE I/O in module code and it didn't work. okay.. simply..

character device driver is only method for interacting with user application in kernel module programming?(it include with block, network)

  • 1
    No; in the kernel you have to be careful to use libraries designed for use in the kernel. You absolutely cannot use just any old library. – Jonathan Leffler Jun 15 '16 at 06:29
  • 1
    It's a terrible idea trying using standard library from kernel space. There are other ways of communication from userspace to kernelspace like. using `procfs` or `sysfs` entries. – rakib_ Jun 15 '16 at 06:34
  • okay i see. if i want to read some value in a file directly without using device node, how can i do in the kernel module? –  Jun 15 '16 at 08:06
  • 2
    Use [netlink](http://man7.org/linux/man-pages/man7/netlink.7.html). Also see [this](http://stackoverflow.com/questions/3299386/how-to-use-netlink-socket-to-communicate-with-a-kernel-module) – red0ct Jun 15 '16 at 08:17

0 Answers0