开发者

Linux - Programmatically write to a proc file

开发者 https://www.devze.com 2022-12-25 09:34 出处:网络
I have found several examples online where we can create a proc file, assign read and write methods that are called every time the proc file is opened for read or written to.

I have found several examples online where we can create a proc file, assign read and write methods that are called every time the proc file is opened for read or written to.

However, I can't seem to find any documentation on how to programatically write to a proc file. Ideally, I would like to add a timestamp with other user details every time the proc file is opened for read or for write. Again, I've found where I can add the read and write functions that are triggered when the proc file is opened, but I can't find documentation on how to actually write to a proc file programatically. This would be different开发者_运维技巧 from a regular IO read/write, correct?


Fixed the issue -- I didn't fully understand proc files but now understand how they work and that there isn't really any file to write to -- just variables. Got it working. Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消