LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-26-2003, 06: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, 06: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, 06: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, 11:54 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Yes, with a little in-line assembly.
Compile with gcc.
 
Old 10-27-2003, 12: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



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

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

All times are GMT -5. The time now is 08:09 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