LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-11-2005, 05:24 AM   #1
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
Best way to retrieve system and hardware info


I have been poking around the Linux programming manuals for some time now, but there seems to be a lack of function calls that retrieves system information like CPU info, hardware info, memory, hard disk, devices and so on.

I know that some of the information can be retrieved from configuration files, but the problem is that there is no generic location for certain config files in Linux. Also this seems to be a somewhat unsatisfactory solution.

What is the best way to retrieve system information in a generic way in Linux?
  1. Call the command-line system information calls from and retrieve info from the shell?
  2. Functions calls from within C?
  3. Reading configuration files and/or other directories?

Thank you.
 
Old 04-11-2005, 05:34 AM   #2
TMH
Member
 
Registered: Nov 2004
Location: UK
Distribution: Gentoo
Posts: 61

Rep: Reputation: 15
Loads, and loads of info can be obtained through /proc
 
Old 04-11-2005, 05:38 AM   #3
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178

Original Poster
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
Yes. I saw /proc. Is this generic on all systems?

Also how do I retrieve these files from programming. Just open them or pipe them from a shell output?
 
Old 04-11-2005, 06:01 AM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
As per request, moved to Programming
 
Old 04-11-2005, 06:23 AM   #5
TMH
Member
 
Registered: Nov 2004
Location: UK
Distribution: Gentoo
Posts: 61

Rep: Reputation: 15
How you retrieve these files depends on your programming language of choice.

This is not generic on all systems, as there is the option to not compile /proc into the linux kernel. However, just about everyone compiles it in because it's just so useful. I know it's definately there by default on a SuSE system.
 
Old 04-11-2005, 07:29 AM   #6
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178

Original Poster
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
I will be using C.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System Info (Distro, Hardware ,etc...) BinJajer General 4 11-27-2005 08:22 AM
how could i retrieve the system datetime in Linux C++? nelnel Programming 1 08-25-2005 10:09 AM
help trying to retrieve info from raid or another hge3 newusermike Linux - Newbie 4 07-30-2005 07:46 PM
System Hardware Info apocolpse Linux - Hardware 4 11-20-2004 09:15 AM
Authenticatin Service cannot retrieve authentication info sdandeker Linux - Security 3 04-03-2004 01:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration