LinuxQuestions.org
Register a domain and help support LQ
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-26-2003, 07:01 PM   #1
zael
LQ Newbie
 
Registered: Aug 2003
Posts: 26

Rep: Reputation: 15
Find Serial Number of Machine


Does anyone know how you can find the serial number of a machine threw linux i know this is possiable in Windows using DMI or WMI. But is it possiable in Linux?
 
Old 10-26-2003, 07:13 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
you mean of the cpu? like this:
Code:
unsigned int get_cpu()
{
        asm("movl $0x3, %eax");\
        asm("cpuid");
        return;
}

int main()
{
        unsigned int    cpuid = 0;

        printf("CPU id is %u\n", (cpuid = get_cpu()));

        return 0;
}
more info here http://grafi.ii.pw.edu.pl/gbm/x86/cpuid.html
 
Old 10-27-2003, 07:55 AM   #3
zael
LQ Newbie
 
Registered: Aug 2003
Posts: 26

Original Poster
Rep: Reputation: 15
What language is this for C?
 
Old 10-27-2003, 12:54 PM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Yes, with a little in-line assembly.
Compile with gcc.
 
Old 10-27-2003, 01:39 PM   #5
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
yea im just not sure of the functions that wrap that asm instruction, so i just use the asm call directly
plus this way is platform independent.
 
  


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
Nero 2.0.0.3 serial number TigerLinux Linux - Software 13 10-20-2005 04:13 AM
Hard Drive Serial Number? daver Linux - Hardware 4 03-17-2004 10:57 AM
Floppy serial number k__ Linux - General 1 06-29-2002 11:29 PM
where can I find the serial number and the key of Kylix2.0? wolfshome Linux - Software 5 05-29-2002 07:28 AM
how do i find number of cpus in one machine? doublefailure Linux - General 3 03-26-2002 03:52 PM


All times are GMT -5. The time now is 10:09 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration