»ùÓÚLinuxµÄ±ãЯǶÈëʽÉ豸µçÔ´¹ÜÀí½â¾ö·½°¸
Ç°¡¡ÑÔ
¡¡¡¡Ëæן÷ÖÖ±ãЯǶÈëʽÉ豸ÐÔÄܵÄÈÕÒæÌá¸ß£¬¹¦ÄÜÈÕÒæ·á¸»£¬ÆäµçÔ´½ôÕŵÄÎÊÌâÒ²ÈÕÒæÍ»³ö£¬¹úÄÚÐÂÍƳöµÄijЩ¾ßÓÐPDAµÈ¶àÖÖ¹¦ÄܵÄÖÇÄܵ绰ÔÚÃܼ¯Ê¹ÓÃÏÂÖ»ÄÜά³Ö°ëÌ죬¶àÊýÉãÏñ»ú
ºÍÊýÂëÏà»ú
ÔÚ
Ò»´Î³äµçºó¶¼Ö»ÓÐÒ»¸öСʱ×óÓÒµÄÀÛ»ý¹¤×÷ʱ¼ä¡£Linux×÷Ϊһ¸ö¿ª·ÅÔ´´úÂëµÄ²Ù×÷ϵͳ£¬ÓµÓзdz£·á¸»µÄÈí¼þ×ÊÔ´ºÍƽ̨֧³Ö£¬ÕâʹµÃǶÈëʽϵͳ¿ª·¢µÄÖÜÆÚ
´ó´óËõ¶Ì£¬Ô½À´Ô½¶àµÄÉÌÓúÍͨÓÃǶÈëʽϵͳ¶¼²ÉÓÃLinux×÷ΪÈí¼þƽ̨¡£Òò´ËÓбØÒª¶ÔLinuxϵͳµÄµçÔ´¹ÜÀí»úÖƽøÐÐÉîÈëÑо¿¡£
LinuxÄں˵çÔ´¹ÜÀí»úÖÆ·ÖÎö
¡¡¡¡ Linux×÷Ϊһ¸öÇ¿´ó¶ø³ÉÊìµÄ²Ù×÷ϵͳ£¬±¾ÉíÌṩÁËÒ»Ì×´ÓÓû§¿Õ¼äµ½ÏµÍ³¿Õ¼äµÄ£¬ÓÉÉ϶øϵÄÈí¼þµçÔ´¹ÜÀí»úÖÆ¡£
µçÔ´¹ÜÀí×Óϵͳ
LinuxÄÚºËʵÏÖÁËÒ»¸öµçÔ´¹ÜÀí×ÓϵͳÓÃÓÚͳһ¹ÜÀíÿ¸öÉ豸¡£Ô´´úÂëpm.hºÍpm.cÖж¨ÒåºÍʵÏÖÁËÖ÷ÒªµÄ½Ó¿Ú
º¯Êý¡£Èç±í1Ëùʾ¡£
¡¡¡¡
¡¡¡¡ ͨ¹ýÕâЩ½Ó¿Úº¯Êý¾Í¿ÉÒÔ½«×Ô¼ºµÄÓ²¼þÉ豸ÄÉÈëµçÔ´¹ÜÀí×ÓϵͳʹÆä³ÉΪϵͳµçÔ´
¹ÜÀíµÄÒ»²¿·Ö¡£ÕâÐèÒªÔÚ±àдÉ豸Çý¶¯³ÌÐòµÄʱºòÍê³ÉÏÂÃæµÄ¹¤×÷:
¡¡¡¡(1)ÔÚ³õʼ»¯Çý¶¯Ê±£¬Ê¹ÓÃpm_ register¶ÔÉ豸µÄÿ¸öʵÀý( instance)½øÐÐ×¢²á;ÔÚÇå³ýÇý¶¯Ê±Ê¹ÓÃpm_unregisterÀ´È¡ÏûÉ豸µÄ×¢²á¡£
¡¡¡¡(2)ÔÚ¶ÔÓ²¼þ½øÐвÙ×÷֮ǰµ÷ÓÃpm_access (ÕâÑù»á±£Ö¤É豸Òѱ»»½ÐѲ¢ÇÒ´¦ÓÚready״̬) ¡£
¡¡
¡¡(3)±àд×Ô¼ºµÄpm
_callbackº¯Êý¡£¿ª·¢ÈËÔ±Ó¦¸ÃÔÚÉ豸»òϵͳ½øÈësuspend״̬ʱ±£ÁôÉ豸ºÍϵͳµÄÉÏÏÂÎĵ½°²È«µÄµØ·½£¬²¢ÔÚÉ豸»òϵͳre
-sumeʱ»Ö¸´ÆäÉÏÏÂÎÄ£¬Ê¹Ö®Äܹ»¼ÌÐøÔËÐУ¬±àдpm_callbackº¯ÊýÊÇÇý¶¯ÊµÏÖÉ豸µçÔ´¹ÜÀíµÄÖص㡣
¡¡¡¡(4)µ±É豸²»ÔÚ±»Ê¹ÓõÄʱºòµ÷ÓÃpm_dev_idleº¯Êý£¬Õâ¸ö²Ù×÷ÊÇ¿ÉÑ¡µÄ£¬¿ÉÒÔÔöÇ¿É豸idle״̬µÄ¼à²âÄÜÁ¦¡£
µçÔ´¹ÜÀíÉ豸
¡¡
¡¡½«É豸¼ÓÈëµ½µçÔ´¹ÜÀí×Óϵͳºó£¬¸ÃÉ豸¾ÍÒѾÓÐÁË´¦ÀíµçÔ´¹ÜÀíÇëÇóµÄÄÜÁ¦£¬µ«ÊÇϵͳµÄµçÔ´¹ÜÀíÐÐΪ²¢²»»áÖ÷¶¯·¢Éú¡£Òò´Ë»¹ÐèÒªÒ»¸öµçÔ´¹ÜÀíÉ豸À´½ÓÊÜÓÃ
»§ÇëÇ󣬲úÉúµçÔ´¹ÜÀíÐÐΪ¡£ÕâÀïËùÖ¸µÄÉ豸²¢²»ÊÇÒ»¸öÕæʵµÄÓ²¼þÉ豸£¬¶øÊÇÒ»¸öÔÚLinuxϵͳ¿Õ¼äÀï½ÓÊÜÓû§¿ØÖƵÄÐéÄâÉ豸£¬Ëü¿ÉÒÔÊÇÒ»¸ö¼òµ¥
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
2009 Äê 4 ÔÂ 23 ÈÕ
±¾ÎÄÖÐÎÒÃÇÕë¶Ô Linux É϶àÏ̱߳à³ÌµÄÖ÷ÒªÌØÐÔ×ܽá³ö 5 Ìõ¾Ñ飬ÓÃÒÔ¸ÄÉÆ Linux ¶àÏ̱߳à³ÌµÄÏ°¹ßºÍ±ÜÃâÆäÖеĿª·¢ÏÝÚå¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇ´©²åһЩ Windows µÄ±à³ÌÓÃÀýÓÃÒÔ¶Ô±È Linux ÌØÐÔ£¬ÒÔ¼ÓÉî¶ÁÕßÓ¡Ïó¡£
±³¾°
Linux ƽ̨ÉϵĶàÏ̳߳ÌÐò¿ª·¢Ïà¶ÔÓ¦ÆäËûƽ̨£¨±ÈÈç Windows£©µÄ¶àÏß³Ì API ÓÐһЩϸ΢ ......
ÔÚÍøÉÏ¿´µ½ÓÐÈË×ܽáµÃ²»´í
1£®¿ª»úÆô¶¯Ê±×Ô¶¯ÔËÐгÌÐò
Linux
¼ÓÔغó, Ëü½«³õʼ»¯Ó²¼þºÍÉ豸Çý¶¯, È»ºóÔËÐеÚÒ»¸ö½ø³Ìinit¡£init¸ù¾ÝÅäÖÃÎļþ¼ÌÐøÒýµ¼¹ý³Ì£¬Æô¶¯ÆäËü½ø³Ì¡£Í¨³£Çé¿öÏ£¬Ð޸ķÅÖÃ
ÔÚ /etc/rc»ò /etc/rc.d »ò /etc/rc?.d Ŀ¼ÏµĽű¾Îļþ£¬¿ÉÒÔʹinit×Ô¶¯Æô¶¯Æ ......
NAPI ÊÇ Linux ÉϲÉÓõÄÒ»ÖÖÌá¸ßÍøÂç´¦ÀíЧÂʵļ¼Êõ£¬ËüµÄºËÐĸÅÄî¾ÍÊDz»²ÉÓÃÖжϵķ½Ê½¶ÁÈ¡Êý¾Ý£¬¶ø´úÖ®ÒÔÊ×ÏȲÉÓÃÖжϻ½ÐÑÊý¾Ý½ÓÊյķþÎñ³ÌÐò£¬È»ºó POLL µÄ·½·¨À´ÂÖѯÊý¾Ý¡£Ëæ×ÅÍøÂçµÄ½ÓÊÕËٶȵÄÔö¼Ó£¬NIC ´¥·¢µÄÖжÏÄÜ×öµ½²»¶Ï¼õÉÙ£¬Ä¿Ç° NAPI ¼¼ÊõÒѾÔÚÍø¿¨Çý¶¯²ãºÍÍøÂç²ãµÃµ½Á˹㷺µÄÓ¦Óã¬Çý¶¯²ã´ÎÉÏÒѾÓÐ E1000 Ï ......
¹ØÓÚlinuxÄÚºËÖеÄ"__attribute__ ((packed))"
À´Ô´£º
http://jimmy-lee.blog.hexun.com/8001013_d.html
__attrubte__ ((packed)) µÄ×÷ÓþÍÊǸæËß±àÒëÆ÷È¡Ïû½á¹¹ÔÚ±àÒë¹ý³ÌÖеÄÓÅ»¯¶ÔÆë,°´ÕÕʵ¼ÊÕ¼ÓÃ×Ö½ÚÊý½øÐжÔÆë¡£
#define __u8 unsigned char
#define __u16 unsigned short
......