Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Aug 2006 00:12:31 -0700
From:      Garrett Cooper <youshi10@u.washington.edu>
To:        freebsd-questions@freebsd.org
Subject:   Re: Gotta start somewhere ... how many of us are really out there?
Message-ID:  <44CEFEDF.4060503@u.washington.edu>
In-Reply-To: <002901c6b531$b4013200$3c01a8c0@coolf89ea26645>
References:  <20060728164526.E27679@ganymede.hub.org><df9ac37c0607281319s5da0f64ese5fa57df1ef11a4d@mail.gmail.com><ef10de9a0607282139i51fdde5ch58525fa3347364d2@mail.gmail.com><87slklj9hu.fsf@photon.homelinux.org><20060729021007.F27679@ganymede.hub.org><44CD41EC.6030605@freebsd.org>	<20060730233839.I27679@ganymede.hub.org><44CDAA98.3030702@freebsd.org>	<44CDE02F.4090604@dial.pipex.com><44CE7DD0.9070902@childeric.freeserve.co.uk><871ws1v261.fsf@photon.homelinux.org>	<20060731220830.B27679@ganymede.hub.org> <002901c6b531$b4013200$3c01a8c0@coolf89ea26645>

next in thread | previous in thread | raw e-mail | index | archive | help


Ted Mittelstaedt wrote:
> ----- Original Message ----- From: "User Freebsd" <freebsd@hub.org>
> To: "Xiao-Yong Jin" <xj2106@columbia.edu>
> Cc: <freebsd-questions@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@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44CEFEDF.4060503>