This is not how it works. When a user-space program opens files, they are generated on the fly in each case. Most of them are readonly and are generated by a common mechanism:
- Register a record using create_proc_read_entry
- Put a callback function (called read_proc by convention) that is called when the file is read.
- This callback function should fill in the supplied buffer and (usually) call proc_calc_metrics to update the file pointer, etc., delivered to user space.
You (from the kernel) do not "write" procfs files, you dynamically send results when user space requests them.
source
share