Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 10-26-2003, 06:01 PM   #1
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
Registered: Mar 2003
Posts: 804

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

int main()
        unsigned int    cpuid = 0;

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

        return 0;
more info here
Old 10-27-2003, 06:55 AM   #3
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
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
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.


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 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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:40 PM.

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