aajjbb
aajjbb

Reputation: 91

How do I get Linux hardware and system info via a C library?

I'm trying to implement a system which sends via Bluetooth sockets, information about the current system (in fact, a Linux server). This back-end code is in C. I'd like to know if there's an available library to get info like cpu temperature, disk usage and process running, just to name a few inside C code. If it's not possible, what kind of alternatives do you suggest to me ?

Upvotes: 0

Views: 1136

Answers (1)

rakib_
rakib_

Reputation: 142775

To find disk usages - see lstat(), pick st_size to get the size of file and get the disk usages. No of running processes could be found by reading /proc, all the running processes has pidno under /proc. And, currently, I'm unaware of how to get cpu temperature. But, you can get cpufreq related info from /sys/devices/system/cpu/cpufreq.

Upvotes: 1

Related Questions