Gotta start somewhere ... how many of us are really out there?

Garrett Cooper youshi10 at u.washington.edu
Tue Aug 1 07:12:23 UTC 2006



Ted Mittelstaedt wrote:
> ----- Original Message ----- From: "User Freebsd" <freebsd at hub.org>
> To: "Xiao-Yong Jin" <xj2106 at columbia.edu>
> Cc: <freebsd-questions at freebsd.org>
> Sent: Monday, July 31, 2006 6:08 PM
> Subject: Re: Gotta start somewhere ... how many of us are really out 
> there?
>
>
>  
>> On Mon, 31 Jul 2006, Xiao-Yong Jin wrote:
>>
>>    
>>> Chris Whitehouse <chris at childeric.freeserve.co.uk> writes:
>>>
>>>      
>>>> Alex Zbyslaw wrote:
>>>>        
>>>>> Counting portsnap and cvsup accesses is non-intrusive - i.e. nothing
>>>>> sent from local host - will count systems from any version of
>>>>> FreeBSD, but will never count everything because sites with multiple
>>>>> hosts may easily have local propagation mechanisms.  But you will
>>>>> get an order of magnitude.  However, how do you deal with systems
>>>>> with variable IPs?  I don't know enough about the internals of
>>>>> either portsnap or cvsup to know if there is some kind of unique id
>>>>> associated with hosts.  If not, then you'd wildly over count for
>>>>> many home-based, variable IP systems.
>>>>>           
>>>> Maybe not so many, my non-static ip hasn't changed since I signed up 3
>>>> years ago despite turning off the modem for the odd day or
>>>> two. Another network I look after also hasn't changed in a year.
>>>>
>>>>         
>>> But one can't rely on that.  You'll definitely see more than one ip
>>> associated with my laptop, if I move it around.
>>>
>>> A more reliable way that I can think of is generating a unique ID
>>> number when a system finishes installation or upon the first boot.
>>> However, it may involve some additional privacy problem.  What do you
>>> think?
>>>       
>> How does Solaris generate its 'hostid'?  Is it a hardware/sparc 
>> thing, or
>> software?
>>
>>     
>
> All Sparc processors have serial numbers, always had.  Sun's compiler and
> some other
> programs of theirs are serialized and when you buy them you have to 
> send in
> the
> cpu serial number to Sun who generates a key that will only allow the
> compiler
> to run on that system.  If you move the compiler you have to get 
> another key
> and
> certify to Sun with a legal document that you will not run it on the old
> system, etc.
>
> At least that was how it worked last I dealt with that about 7 years ago.
>
> I believe modern pentiums are also serialized.  There's ways to do a 
> unique
> ID
> nowadays.  None of them are portable and so these methods are frowned on.
>
> Ted
CPUID's on Intel processors can be found using something similar to the 
program I made below...

/**
*
* Author: Garrett Cooper
* File: cpuid_test.cpp
*
* Version: 0.1
* Date: 2006.03.24
*
* This program is a simple C one that takes a IA32 logical
* processor [think real processor, core, or hyperthreading capable 
processor's
* virtual processor(s)] and prints out its ID, via the embedded IA32 cpuid
* asm instruction.
*
* Reference: 
http://www.intel.com/cd/ids/developer/asmo-na/eng/43851.htm?prn=y
*
* Note: If you compile using Cygwin, use this command to compile in order
* to use a DOS prompt to execute the file:
*
*     gcc -mno-cygwin -o cpuid_test.exe cpuid_test.c
*
* This code will no work in MSVS I believe, because it follows GCC's
* convention for inline ASM code.
*
*
* Version: 0.2
* Date: 2006.03.27
*
* Inline C++ function was added so then the program wouldn't just print 
out the
* compiling machine's cpuid when I distributed the binary.
*
* The proper command for compiling now is:
*
*    gcc -mno-cygwin -o cpuid_test.exe cpuid_test.cpp
*
*/

#include <stdio.h>
#include <stdlib.h>

inline void print_cpuid() {

   unsigned int id = 0;

       asm(
               "mov $1, %%eax;"
               "cpuid;"
               "mov %%ebx, %0;"
                       : "=r" (id)
       );

       printf("cpuid=%4xh\n",id);

}

int main() {

   print_cpuid();

   system("pause");

   return 0;

}

You should be able to figure out the ID of your processor if it's a P3 
or newer IIRC. This was part of the whole snafu with Intel and having 
people's serial numbers be transmitted online, I think.
-Garrett




More information about the freebsd-questions mailing list