Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÏ»ñÈ¡CPUID¡¢Ó²ÅÌÐòÁкÅÓëMACµØÖ·


 
ÔںܶàϵͳÈí¼þµÄ¿ª·¢ÖУ¬ÐèҪʹÓÃһЩϵͳµÄΨһÐÔÐÅÏ¢¡£ËùÒÔ£¬µÃµ½Ö÷»úµÄCPUID¡¢Ó²ÅÌÐòÁкż°Íø¿¨µÄMACµØÖ·£¬¾Í³É¸öÒ»¼þºÜÖØÒªµÄÓ¦Óá£
±¾È˾­¹ýÒ»·¬google¼´×Ô¼ºµÄ×êÑУ¬»ù±¾ÉÏʵÏÖÁËÕ⼸¸ö¹¦ÄÜ¡£ÐèÒªµÄ×¼±¸ÖªÊ¶ÓУº
GCCµÄǶÈë»ã±à£¬¾ßÌåµÄGCCǶÈë»ã±à֪ʶ£¬Çë²Î¿¼Ïà¹ØÊÖ²á
ioctlϵͳµ÷Ó㬾ßÌåµÄµ÷Ó÷½·¨£¬Çë²é¿´ÊÖ²áÒ³
»ñÈ¡CPUID
°´ÕÕÍøÉÏÌṩµÄ˵Ã÷£¬CPUID²¢²»ÊÇËùÓеÄIntel CPU¶¼Ö§³ÖµÄ¡£Èç¹ûÖ§³Ö£¬»ã±àµ÷ÓÃΪ£ºeaxÖÃ0000_0003£¬µ÷ÓÃcpuid¡£
ÒÔÏÂΪʵÏÖ´úÂ루ÔÚÎÒµÄCPUÉÏ£¬²¢Ã»Óеõ½£©£º
#define cpuid(in,a,b,c,d) asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
static int
getcpuid (char *id, size_t max)
{
int i;
unsigned long li, maxi, maxei, ebx, ecx, edx, unused;
cpuid (0, maxi, unused, unused, unused);
maxi &= 0xffff;
if (maxi < 3)
{
return -1;
}
cpuid (3, eax, ebx, ecx, edx);
snprintf (id, max, "%08lx %08lx %08lx %08lx", eax, ebx, ecx, edx);
fprintf (stdout, "get cpu id: %s\n", id);
return 0;
}
»ñÈ¡Ó²ÅÌÐòÁкÅ
Õâ¸öµÄʵÏÖ£¬²ÉÓõÄÊǶÁÈ¡/etc/mtabÎļþ£¬ÕÒµ½/£¨¼´¸ùĿ¼£©¹ÒÔصÄÉ豸Îļþ£¬È»ºó´ò¿ªËü£¬ÔÙÓÃϵͳµ÷ÓÃioctlÀ´ÊµÏֵġ£
ioctlµÚ¶þ¸ö²ÎÊýΪHDIO_GET_IDENTITY, »ñµÃÖ¸¶¨ÎļþÃèÊö·ûµÄ±êÖ¾ºÅ
ioctlµÄµÚÈý¸ö²ÎÊýΪstruct hd_driveid £¬ÔÚlinux/hdreg.hÖУ¬struct hd_driveidµÄÉùÃ÷ÓÐ
struct hd_driveid {
unsigned short config; / lots of obsolete bit flags */
unsigned short cyls; /* Obsolete, "physical" cyls */
unsigned short reserved2; /* reserved (word 2) */
unsigned short heads; /* Obsolete, "physical" heads */
unsigned short track_bytes; /* unformatted bytes per track */
unsigned short sector_bytes; /* unformatted bytes per sector */
unsigned short sectors; /* Obsolete, "physical" sectors per track */
unsigned short vendor0; /* vendor unique */
unsigned short vendor1; /* vendor unique */
unsigned short vendor2; /* Retired vendor unique */
unsigned char serial_no[20]; /* 0 = not_specified */
unsigned short buf_type; /* Retired */
unsigned short buf_size; /* Retired, 512 byte increments


Ïà¹ØÎĵµ£º

ÓÃLinuxÏÂPerl½Å±¾Á¬½ÓSQLServer

×¼±¸¹¤×÷:
¡¡¡¡Óõ½µÄperl À©Õ¹×é¼þ(modules)ÔÚÉÏƪÌù³ö.( win32::odbc Ä£¿é
)ÏÂÔØ×é¼þºó°´ÕÕReadmeÎļþ°²×°µ¹ÏìӦĿ¼.ÅäÖúÃÏàÓ¦µÄodbcÊý¾ÝÔ´.
¡¡¡¡
¡¡¡¡³ÌÐòʵÏÖ:
¡¡¡¡Ê¹ÓÃ
¡¡¡¡use
Win32::ODBC;
¡¡¡¡
¡¡¡¡Óï¾ä°üº¬Ó¦Ê¹ÓõÄÄ£¿éÊÇwin32::odbc,д³öÊý¾Ý¿â
Á¬½Ó×Ö·û´®
¡¡¡¡
¡¡¡¡$DSN = "DSN =
My DSN ......

LinuxÏÂKill¶à¸ö½ø³Ì

¹¤×÷Öо­³£ÐèÒªKill¶à¸ö½ø³Ì£¬Èç¹ûÕâЩ½ø³ÌÓй²Í¬µÄÌص㣬¾Í¿ÉÒÔÓÃÒ»ÌõÃüÁîKillµôËüÃÇ¡£
±ÈÈçÇå³ýOracleÊý¾Ý¿âµÄËùÓÐÔ¶³ÌÁ¬½Ó½ø³Ì£º

ps -efww|grep LOCAL=NO|grep -v grep|cut -c 9-15|xargs kill -9
¡¡¡¡¹ÜµÀ·û“|”ÓÃÀ´¸ô¿ªÁ½¸öÃüÁ¹ÜµÀ·û×ó±ßÃüÁîµÄÊä³ö»á×÷Ϊ¹ÜµÀ·ûÓÒ±ßÃüÁîµÄÊäÈë¡£ÏÂÃæ˵˵Óà ......

Linux Telnet·þÎñ¿ªÆô

½ñÌ칫˾ÓиöͬÊÂŪÁ˸öRed Hat Enterprise 5×°£¬ÏµÍ³×°ºÃºó£¬·¢ÏÖtelnet²»ÄÜÓã¬sshÊÇ¿ÉÒԵġ£¸ãÁ˺þ㬲Ÿø¸ã¶¨£¬½áºÏÒÔǰժϵĹØÓÚÕâ·½ÃæµÄ×ÊÁÏ£¬²Î¿¼ÈçÏ£º
1¡£¸ÅÊöLinuxÌṩ·þÎñÊÇÓÉÔËÐÐÔÚºǫ́µÄÊØ»¤³ÌÐò£¨daemon£©À´Ö´Ðеġ£
ÊØ»¤½ø³ÌµÄ¹¤×÷¾ÍÊÇ´ò¿ª1¸ö¶Ë¿Ú£¨port£©£¬µÈ´ý£¨listen£©½øÈëµÄÁ¬½Ó¡£ÔÚC/SģʽÖУ¬Èç¹ ......

Linux 0.12ÄÚºË

ÔÚÓ¦ÓóÌÐò¿ª·¢Ê±£¬Ò²¾­³£ÐèÒªÈçϵĶ¨Ê±Æ÷. ÕâÀï¶Ô¶¨Ê±Æ÷×öÁËÒ»¸öÓÅ»¯£¬¾ÍÊÇÔÚ²åÈë¶ÓÁÐÖÐʱ½øÐÐÁËÒ»´ÎÅÅÐò£¬Ê¹µÃ¼ì²âʱ²»ÐèÒª±éÀúÕû¸öÁ´±í£¬Ö»Ðè°ÑÅÅÔÚÇ°ÃæµÄ¼¸¸öµ½Ê±µÄÈÎÎñÈ¡³öÀ´¾Í¿ÉÒÔÁË¡£
static struct timer_list {
     long jiffies;
     void (*fn)();
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ