I am going to write a Lexical that is going to be part of a kernel module in which I will parse a file and return tokens. For that, I may need to use functions like fopen, getc,putc,fseek etc which obviously are user space functions. I have searched for alternatives to these functions in kernel space and I found functions like open, filp_open, sys_open etc which I guess would be OK for me. But what I want to know is whether functions like getc, putc, seek etc (which can be very handy in file operations), are available in kernel space?
Don't.
Reading files, and especially complex configuration files, is not something which should be done from the kernel.
There's a lot of information about why this is a bad idea. The KernelNewbies FAQ is a good start.
Really, really don't do this. I integrate a lot of vendor (kernel) code, and this is one of the mistakes which keeps coming up and biting us. Learn to do things the right way from the start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With