I'm trying to write a system monitor for my desktop (no, I don't want to use something else), but I've come across a problem I can't understand.
I open the file `/sys/class/power_supply/BAT0/uevent` and notice all the fields. Close it and open it again and notice the field `POWER_SUPPLY_TEMP` value has changed from `315` to `318`. But when I do `ls /sys/class/power_supply/BAT0/uevent` it lists the modified date as the day I booted my system up (2 days prior).
How can the information in the file be updated but not have the attributes updated?
Also, why `inotify` isn't informed of a change to the file?
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
How can a file's contents change but the file's attibutes remain the same?
- canci
- Global Moderator
- Posts: 2502
- Joined: 2006-09-24 11:28
- Has thanked: 136 times
- Been thanked: 136 times
Re: How can a file's contents change but the file's attibutes remain the same?
Maybe the polling is so frequent that disk i/o or journaling would be compromised otherwise?
Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
READ THIS:
* How to Post a Thread Here
* Other Tips and Great Resources
Re: How can a file's contents change but the file's attibutes remain the same?
The stuff in /sys are not files. They just behave like files. The content is actually retrieved/calculated by the kernel *when you read*, while the "file" itself is created during boot, when /sys is mounted.
Re: How can a file's contents change but the file's attibutes remain the same?
Ty for the responses.
Looks like I'll have to make a `cron` job to copy the file regularly.
Looks like I'll have to make a `cron` job to copy the file regularly.