ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to get the whole contents of cpu info, throttling, battery status like information. through system calls only and have to store them in a structure.. pls dont suggest:1) reading /proc/cpuinfo 2)script program 3) system command
I want only system calls except uname();
in windows we have APIS to get all those above mentioned infos. So is there any system calls like that. pls guide me
What is wrong with reading system info from /proc ?
Quote:
Originally Posted by naveenisback
in windows we have APIS to get all those above mentioned infos.
The Windows way is not necessarily (nor even very often) the right way.
Part of the Unix design philosophy is to have fewer OS API's than you would find in a non Unix OS and to use the basic file I/O APIs in imaginative ways to reduce the need for other APIs.
The /proc filesystem is a logical extension of that philosophy. I think Linux has or had various APIs to get some of the same info that you can get from /proc, but using /proc is more general and more likely to be able to smoothly transition as the underlying OS features are changed or enhanced.
ya ofcourse.. I agree with u.. If we read /proc/cpuinfo, the problem is with parsing the file to get the our needed appropriate information and storing them back in a structure variables. It increases my program size. So asked. If u know the APIs please post it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.