LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 10-30-2005, 10:40 AM   #1
alltime
Member
 
Registered: Jan 2005
Distribution: Mandrake 10.1 with kernel 2.6.10
Posts: 60

Rep: Reputation: 15
CPU information structure


I'm creating a number of Kernel modules to display specific information about the system but i'm not sure what header files/structures to use.

I want to use a strcuture that would list the following information

1) MAC address
2) Memory information (current memory, page file size, Hard drive space)
 
Old 10-30-2005, 12:15 PM   #2
alltime
Member
 
Registered: Jan 2005
Distribution: Mandrake 10.1 with kernel 2.6.10
Posts: 60

Original Poster
Rep: Reputation: 15
Okay I figured out the MAC Address. I just used linux/pci.h for gathering all of the information with use of inb in my function.
 
Old 10-31-2005, 05:58 AM   #3
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
To get the MAC address in a more portable way (with PCI or NOT), you should

Code:
Open a socket
Prepare a ifreq structure with the name of the interface (eg eth0)
Pass the socket and the structure to ioctl , asking for ioctl SIOCGIFADDR
Then the MAC address is in ifreq.ifr_hwaddr, you can strcpy to your string
 
  


Reply



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
how to get cpu information on Linux machine laxmi_cs Programming 41 03-05-2013 02:55 AM
kacpid eating cpu 99% cpu time! tjclancy Linux - Software 13 09-19-2011 03:08 PM
structure os2 Programming 6 05-29-2005 07:39 PM
please help guys, wrong cpu speed shown with a regular non-mobile cpu !! : ( maku Linux - Hardware 1 01-02-2005 02:03 PM
Switching off a CPU of a multiple CPU machine kravisudhakar Linux - General 1 12-26-2003 10:13 AM

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

All times are GMT -5. The time now is 03:05 PM.

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