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

linux ÖеÃ×Ô¼ºµÄipµØÖ·´úÂë

DWORD GetLocalAddr(char* interface)
{
 struct ifreq ifr;
    int fd;
    int err;
    unsigned long ip;
    strcpy(ifr.ifr_name, interface);
    fd = socket(AF_INET, SOCK_DGRAM, 0);
    err = ioctl(fd, SIOCGIFADDR, &ifr);
    if (err)
    {
     //perror("ioctl");
     close(fd);
        return 0;
    }
    close(fd);
    memcpy(&ip,ifr.ifr_addr.sa_data + 2,4);
    return ip;
}
µ÷ÓÃÈç
DWORD ip=GetLocalAddr("eth0");


Ïà¹ØÎĵµ£º

linux½ø³Ìµ÷¶ÈÕþ²ß


½ø³Ìµ÷¶ÈÕþ²ß¾ÍÊǵ÷¶ÈϵͳÖÖÄÄÒ»¸ö½ø³ÌÀ´CPUÔËÐС£ÕâÖÖµ÷¶È·Ö2²ã¿¼ÂÇ¡£
µÚÒ»²ã£¬½ø³Ì״̬Õâ¸öÊÇ×îÓÅÏÈ¿¼Âǵģ¬Ò²¾ÍÊÇ˵ÓÅÏȼ¶×î¸ßµÄ¡£ÔÚlinuxÖÐÖ»ÓоÍÐ÷̬µÄ½ø³Ì²ÅÓпÉÄܻᱻµ÷¶ÈÑ¡ÖÐÈ»ºóÕ¼ÓÐCPU£¬ÆäËü״̬µÄ½ø³Ì²»¿ÉÄÜÕ¼Óеĵ½CPU¡£ÏÂÃæÊÇlinuxÖнø³ÌµÄ״̬
TASK_RUNNING:¾ÍÐ÷״̬£¬µÃµ½CPU¾Í¿ÉÒÔÔËÐС£
TASK_INTERRU ......

LinuxÍøÂçÇý¶¯³ÌÐò±àд(¶þ)

¶þ.LinuxϵͳÍøÂçÉ豸Çý¶¯³ÌÐò
¡¡¡¡2.1 ÍøÂçÇý¶¯³ÌÐòµÄ½á¹¹
¡¡¡¡ËùÓеÄLinuxÍøÂçÇý¶¯³ÌÐò×ñѭͨÓõĽӿڡ£Éè¼Æʱ²ÉÓõÄÊÇÃæÏò¶ÔÏóµÄ·½·¨¡£Ò»¸öÉ豸¾ÍÊÇÒ»¸ö¶ÔÏó(device ½á¹¹)£¬ËüÄÚ²¿ÓÐ×Ô¼ºµÄÊý¾ÝºÍ·½·¨¡£Ã¿Ò»¸öÉ豸µÄ·½·¨±»µ÷ÓÃʱµÄµÚÒ»¸ö²ÎÊý¶¼ÊÇÕâ¸öÉ豸¶ÔÏó±¾Éí¡£ÕâÑùÕâ¸ö·½·¨¾Í¿ÉÒÔ´æÈ¡×ÔÉíµÄÊý¾Ý(ÀàËÆÃæÏ ......

[ת] ʹÓÃPythonдLinuxµÄÊØ»¤½ø³Ì(daemon)

A simple unix/linux daemon in Python
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
by Sander Marechal
I've
written a simple Python class for creating daemons on unix/linux
systems. It was pieced together for various other examples, mostly
corrections to various Py ......

Linux ÐźŽéÉÜ

1) SIGHUP
±¾ÐźÅÔÚÓû§ÖÕ¶ËÁ¬½Ó(Õý³£»ò·ÇÕý³£)½áÊøʱ·¢³ö, Í¨³£ÊÇÔÚÖն˵ĿØÖƽø³Ì½áÊøʱ, Í¨ÖªÍ¬Ò»sessionÄڵĸ÷¸ö×÷Òµ, ÕâʱËüÃÇÓë¿ØÖÆÖն˲»ÔÙ¹ØÁª¡£
µÇ¼Linuxʱ£¬ÏµÍ³»á·ÖÅä¸øµÇ¼Óû§Ò»¸öÖÕ¶Ë(Session)¡£ÔÚÕâ¸öÖÕ¶ËÔËÐеÄËùÓгÌÐò£¬°üÀ¨Ç°Ì¨½ø³Ì×éºÍºǫ́½ø³Ì×飬һ°ã¶¼ÊôÓÚÕâ
¸ö Sessio ......

LinuxϵͳµÄÍ·ÎļþºÍ¿âÎļþËÑË÷·¾¶

IncludeµÄheaderÎļþ,Á¬½áÊý¾Ý¿â£¬ÏµÍ³¶¨Ò壬×ܹ²ÓÐÏÂÁÐÀ´Ô´Ö¸¶¨gccÈ¥ÄÇÕÒ¡£
µ±³õÔÚ±àÒëʱָ¶¨µÄ(ÔÚ~gcc/gcc/collect2.c:locatelib()
дÔÚspecsÄÚµÄ
ºóÀ´ÓÃ-D -I -LÖ¸¶¨µÄ
gcc»·¾³±äÁ¿É趨(±àÒëµÄʱºò)
ld.soµÄ»·¾³±äÁ¿(ÕâÊÇrun timeµÄʱºò£©
Ò»¡¢Í·Îļþ
gcc ÔÚ±àÒëʱÈçºÎȥѰÕÒËùÐèÒªµÄÍ·Îļþ £º
¡ùËùÒÔheader fil ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ