Are simple C file operating functions, such as getc, putc, and seek, available in the Linux kernel?

I am going to write Lexical, which will be part of the kernel module in which I will parse the file and return tokens. For this, I may need to use functions such as fopen, getc, putc, fseek , etc., which are obviously functions of user space. I was looking for alternatives to these functions in kernel space, and I found functions like open, filp_open, sys_open , etc., which, I think, would be okay for me. But I want to know if functions like getc, putc, seek , etc. are available in kernel space. (Which is very convenient in file operations)?

+6
source share
1 answer

Not necessary.

Reading files and especially complex configuration files is not something that needs to be done from the kernel.

There is a lot of information on why this is a bad idea. KernelNewbies FAQs are a good start.

Indeed, in fact, do not. I integrate a lot of vendor (kernel) code, and this is one of the bugs that keep coming and biting us. Learn to do everything right from the start.

+5
source

Source: https://habr.com/ru/post/909439/


All Articles