Open a file in kernel space and read some text

Hi all,

I want to open a file in kernel space and read some text from it and store it into a character array. How can I do that? Is there any code example that can guide me? I'm a newbie in kernel programming and was confused from search result in Google.
 
StreamThreader said:
Reading some file in kernel space is secure?

It could be secure if the reading mechanism is implemented properly. However, reading files directly from kernel space is not recommended because it introduces a dependency going in the wrong direction, from kernel to userland. Most often used solutions are like the one used by the PF firewall. The userland utility pfctl(8) handles reading and validation of the ruleset file(s) and it converts the rules into a binary representation that is fed to the kernel side of PF trough a special device, /dev/pf.
 
Back
Top