Linux»·¾³½ø³Ì¼äͨÐÅ£¨Î壩: ¹²ÏíÄڴ棨Ï£©
Linux»·¾³½ø³Ì¼äͨÐÅ£¨Î壩: ¹²ÏíÄڴ棨Ï£©
ÎĵµÑ¡Ïî
´òÓ¡±¾Ò³
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
¼¶±ð£º ³õ¼¶
Ö£ÑåÐË (mlinux@163.com), ¹ú·À¿Æ´ó¹¥¶Á²©Ê¿Ñ§Î»
2003 Äê 5 ÔÂ 01 ÈÕ
ÔÚ¹²ÏíÄڴ棨ÉÏ£©ÖУ¬Ö÷ҪΧÈÆ×Åϵͳµ÷ÓÃmmap()½øÐÐÌÖÂ۵ģ¬±¾²¿·Ö½«ÌÖÂÛϵͳV¹²ÏíÄڴ棬²¢Í¨¹ýʵÑé½á¹û¶Ô±ÈÀ´²ûÊöÁ½ÕßµÄÒìͬ¡£ÏµÍ³V¹²ÏíÄÚ´æÖ¸µÄÊÇ°ÑËùÓй²ÏíÊý¾Ý·ÅÔÚ¹²ÏíÄÚ´æÇøÓò£¨IPC shared memory region£©£¬ÈκÎÏëÒª·ÃÎʸÃÊý¾ÝµÄ½ø³Ì¶¼±ØÐëÔÚ±¾½ø³ÌµÄµØÖ·¿Õ¼äÐÂÔöÒ»¿éÄÚ´æÇøÓò£¬ÓÃÀ´Ó³Éä´æ·Å¹²ÏíÊý¾ÝµÄÎïÀíÄÚ´æÒ³Ãæ¡£
ϵͳµ÷ÓÃmmap()ͨ¹ýÓ³ÉäÒ»¸öÆÕͨÎļþʵÏÖ¹²ÏíÄڴ档ϵͳVÔòÊÇͨ¹ýÓ³ÉäÌØÊâÎļþϵͳshmÖеÄÎļþʵÏÖ½ø³Ì¼äµÄ¹²ÏíÄÚ´æͨÐÅ¡£Ò²¾ÍÊÇ˵£¬Ã¿¸ö¹²ÏíÄÚ´æÇøÓò¶ÔÓ¦ÌØÊâÎļþϵͳshmÖеÄÒ»¸öÎļþ£¨ÕâÊÇͨ¹ýshmid_kernel½á¹¹ÁªÏµÆðÀ´µÄ£©£¬ºóÃ滹½«²ûÊö¡£
1¡¢ÏµÍ³V¹²ÏíÄÚ´æÔÀí
½ø³Ì¼äÐèÒª¹²ÏíµÄÊý¾Ý±»·ÅÔÚÒ»¸ö½Ð×öIPC¹²ÏíÄÚ´æÇøÓòµÄµØ·½£¬ËùÓÐÐèÒª·ÃÎʸù²ÏíÇøÓòµÄ½ø³Ì¶¼Òª°Ñ¸Ã¹²ÏíÇøÓòÓ³Éäµ½±¾½ø³ÌµÄµØÖ·¿Õ¼äÖÐÈ¥¡£ÏµÍ³V¹²ÏíÄÚ´æͨ¹ýshmget»ñµÃ»ò´´½¨Ò»¸öIPC¹²ÏíÄÚ´æÇøÓò£¬²¢·µ»ØÏàÓ¦µÄ±êʶ·û¡£ÄÚºËÔÚ±£Ö¤shmget»ñµÃ»ò´´½¨Ò»¸ö¹²ÏíÄÚ´æÇø£¬³õʼ»¯¸Ã¹²ÏíÄÚ´æÇøÏàÓ¦µÄshmid_kernel½á¹¹×¢Í¬Ê±£¬»¹½«ÔÚÌØÊâÎļþϵͳshmÖУ¬´´½¨²¢´ò¿ªÒ»¸öͬÃûÎļþ£¬²¢ÔÚÄÚ´æÖн¨Á¢Æð¸ÃÎļþµÄÏàÓ¦dentry¼°inode½á¹¹£¬Ð´ò¿ªµÄÎļþ²»ÊôÓÚÈκÎÒ»¸ö½ø³Ì£¨Èκνø³Ì¶¼¿ÉÒÔ·ÃÎʸù²ÏíÄÚ´æÇø£©¡£ËùÓÐÕâÒ»Çж¼ÊÇϵͳµ÷ÓÃshmgetÍê³ÉµÄ¡£
×¢£ºÃ¿Ò»¸ö¹²ÏíÄÚ´æÇø¶¼ÓÐÒ»¸ö¿ØÖƽṹstruct shmid_kernel£¬shmid_kernelÊǹ²ÏíÄÚ´æÇøÓòÖзdz£ÖØÒªµÄÒ»¸öÊý¾Ý½á¹¹£¬ËüÊÇ´æ´¢¹ÜÀíºÍÎļþϵͳ½áºÏÆðÀ´µÄÇÅÁº£¬¶¨ÒåÈçÏ£º
struct shmid_kernel /* private to the kernel */
{
struct kern_ipc_perm shm_perm;
struct file * shm_file;
int id;
unsigned long shm_nattch;
unsigned long shm_segsz;
time_t shm_atim;
time_t shm_dtim;
time_t shm_ctim;
pid_t shm_cprid;
pid_t shm_lprid;
};
¸Ã½á¹¹ÖÐ×îÖØÒªµÄÒ»¸öÓòÓ¦¸ÃÊÇshm_file£¬Ëü´æ´¢Á˽«±»Ó³ÉäÎļþµÄµØÖ·¡£Ã¿¸ö¹²ÏíÄÚ´æÇø¶ÔÏ󶼶ÔÓ¦ÌØÊâÎļþϵͳshmÖеÄÒ»¸öÎļþ£¬Ò»°ãÇé¿öÏ£¬ÌØÊâÎļþϵͳshmÖеÄÎļþÊDz»ÄÜÓÃread()¡¢write()µÈ·½·¨·ÃÎʵģ¬µ±²ÉÈ¡¹²ÏíÄÚ´æµÄ·½Ê½°ÑÆäÖеÄÎļþÓ³Éäµ½½ø³ÌµØÖ·¿Õ¼äºó£¬¿ÉÖ±½Ó²ÉÓ÷ÃÎÊÄÚ´æµÄ·½Ê½¶ÔÆä·ÃÎÊ¡£
ÕâÀïÎÒÃDzÉÓÃ[1]ÖеÄͼ±í¸ø³öÓëϵͳV¹²ÏíÄÚ´æÏà¹Ø
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃ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 ......
rm -rf mydir /* ɾ³ýmydirĿ¼ */
cd mydir /* ½øÈëmydirĿ¼ */
cd – /* »ØÉÏÒ»¼¶Ä¿Â¼ */
cd ~ /* »Ø¸ùĿ¼ */
mv tools tool /* °ÑtoolsĿ¼¸ÄÃûΪtool */
ln -s tool bac
/* ¸øtoolĿ¼´´½¨ÃûΪbacµÄ·ûºÅÁ´½Ó,×îÊìϤµÄÓ¦¸Ã¾ÍÊÇFTPÖÐwwwÁ´½Óµ½public_htmlĿ¼ÁË */
cp -a tool /home/leavex/www /* °ÑtoolÄ ......
================================================================================
=Linux²é¿´Ó²¼þÐÅÏ¢¼°Çý¶¯É豸Ïà¹ØÕûÀí=
============ ......
Èç¹ûÄãºÜÏëÖªµÀÕû¸ö²Ù×÷ϵͳÄÚµÄÿ¸öĿ¼ÄÚ¶¼ÓÐЩʲô£¬Ö´ÐÐÃüÁ
cd / && tree >> ~/filesystem.tree
Õ⽫ÊÇÒ»¸ö¶à´ï8MµÄÎļþ£¬ÀïÃæ»áÃèÊöÕû¸öÎļþϵͳµÄĿ¼¼°ÆäÎļþ½á¹¹£¬ÏÖÔÚ¾ÍÕûÌå¶øÑÔÀ´¸ÅÊöһϣº
Ò»¼¶»ù±¾Ä¿Â¼½á¹¹£º
/
Îļþϵͳ¸ùĿ¼£¬Î»ÓÚÕû¸öÎļþϵͳµÄ×¼¶
/boot
´æ·Å×ÅÆ ......