I am currently trying to create a kernel module that will generate data based on kernel events and insert them into a file. After reading that this is bad (and I agree), I decided that it would be wiser to have data in the / proc file that the user program could extract when necessary. However, this idea led to various problems, especially when and how to clean this file. So I thought ... "Why don't I make a named pipe in / proc and read from that?"
I have a common sense in setting up the read function and the write function for the proc file, but I still have conceptual problems with how I will deal with this. Namely, how could I write such a function to receive arbitrary data and write it to such a channel from the kernel? Does anyone know how you will transfer data to a named pipe from kernel space? In the end, it does not have to be the / proc file (especially if it is wrong for me), but it was the conclusion I came to. Then I will have to figure out how to connect to it from the user program, but I feel that this is a separate issue.
linux pipe kernel procfs fifo
Dan fego
source share