linuxÖÐfork£¨£©º¯ÊýÏê½â
Ò»¡¢forkÈëÃÅ֪ʶ
ÏÈ¿´Ò»¸öÀý×Ó£º
/*
* fork_test.c
* version 1
* Created on: 2010-5-29
* Author: wangth
*/
#include <unistd.h>;
#include <stdio.h>
int main ()
{
pid_t fpid; //fpid±íʾforkº¯Êý·µ»ØµÄÖµ
//´Ëʱ½öÓÐÒ»¸ö½ø³Ì
fpid=fork();
//´Ëʱ²Ù×÷ϵͳÖÐÒѾÓÐÁ½¸ö½ø³ÌÔÚͬʱÔËÐÐ
if (fpid < 0)
printf("error in fork!");
else if (fpid == 0)
printf("I am the child process, my process id is %d\n",getpid());
else
printf("I am the parent process, my process id is %d\n",getpid());
return 0;
}
ÔËÐнá¹ûÊÇ£º
I am the parent process, my process id is 2365
I am the child process, my process id is 2367
Ò»¸ö½ø³Ì£¬°üÀ¨´úÂë¡¢Êý¾ÝºÍ·ÖÅ䏸½ø³ÌµÄ×ÊÔ´¡£fork£¨£©º¯Êýͨ¹ýϵͳµ÷Óô´½¨Ò»¸öÓëÔÀ´½ø³Ì¼¸ºõÍêÈ«ÏàͬµÄ½ø³Ì£¬Ò²¾ÍÊÇÁ½¸ö½ø³Ì¿ÉÒÔ×öÍêÈ«ÏàͬµÄÊ£¬µ«Èç¹û³õʼ²ÎÊý»òÕß´«ÈëµÄ±äÁ¿²»Í¬£¬Á½¸ö½ø³ÌÒ²¿ÉÒÔ×ö²»Í¬µÄÊ¡£
Ò»¸ö½ø³Ìµ÷ÓÃfork£¨£©º¯Êýºó£¬ÏµÍ³ÏȸøÐµĽø³Ì·ÖÅä×ÊÔ´£¬ÀýÈç´æ´¢Êý¾ÝºÍ´úÂëµÄ¿Õ¼ä¡£È»ºó°ÑÔÀ´µÄ½ø³ÌµÄËùÓÐÖµ¶¼¸´ÖƵ½ÐµÄнø³ÌÖУ¬Ö»ÓÐÉÙÊýÖµÓëÔÀ´µÄ½ø³ÌµÄÖµ²»Í¬¡£Ï൱ÓÚ¿Ë¡ÁËÒ»¸ö×Ô¼º¡£
ÔÚÓï¾äpid=fork()֮ǰ£¬Ö»ÓÐÒ»¸ö½ø³ÌÔÚÖ´ÐÐÕâ¶Î´úÂ룬µ«ÔÚÕâÌõÓï¾äÖ®ºó£¬¾Í±ä³ÉÁ½¸ö½ø³ÌÔÚÖ´ÐÐÁË£¬ÕâÁ½¸ö½ø³ÌµÄ¼¸ºõÍêÈ«Ïàͬ£¬½«ÒªÖ´ÐеÄÏÂÒ»ÌõÓï¾ä¶¼ÊÇif(pid<0)……
ΪʲôÁ½¸ö½ø³ÌµÄpid²»Í¬ÄØ£¬ÕâÓëforkº¯ÊýµÄÌØÐÔÓйء£forkµ÷ÓõÄÒ»¸öÆæÃîÖ®´¦¾ÍÊÇËü½ö½ö±»µ÷ÓÃÒ»´Î£¬È´Äܹ»·µ»ØÁ½´Î£¬Ëü¿ÉÄÜÓÐÈýÖÖ²»Í¬µÄ·µ»ØÖµ£º
1£©ÔÚ¸¸½ø³ÌÖУ¬fork·µ»ØÐ´´½¨×Ó½ø³ÌµÄ½ø³ÌID£»
2£©ÔÚ×Ó½ø³ÌÖУ¬fork·µ»Ø0£»
3£©Èç¹û³öÏÖ´íÎó£¬fork·µ»ØÒ»¸ö¸ºÖµ£»
ÔÚforkº¯ÊýÖ´ÐÐÍê±Ïºó£¬Èç¹û´´½¨Ð½ø³Ì³É¹¦£¬Ôò³öÏÖÁ½¸ö½ø³Ì£¬Ò»¸öÊÇ×Ó½ø³Ì£¬Ò»¸öÊǸ¸½ø³Ì¡£ÔÚ×Ó½ø³ÌÖУ¬forkº¯Êý·µ»Ø0£¬ÔÚ¸¸½ø³ÌÖУ¬fork·µ»ØÐ´´½¨×Ó½ø³ÌµÄ½ø³ÌID¡£ÎÒÃÇ¿ÉÒÔͨ¹ýfork·µ»ØµÄÖµÀ´Åжϵ±Ç°½ø³ÌÊÇ×Ó½ø³Ì»¹ÊǸ¸½ø³Ì¡£
fork³ö´í¿ÉÄÜÓÐÁ½ÖÖÔÒ
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃ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 ......
¹úÍâ
¡¡¡¡http://lwn.net/
¡¡¡¡http://www.tldp.org/
¡¡¡¡https://rhn.redhat.com/
¡¡¡¡http://www.justlinux.com/
¡¡¡¡http://www.linuxtoday.com/
¡¡¡¡http://www.linuxquestions.org/
¡¡¡¡http://www.fokus.gmd.de/linux/
¡¡¡¡http://www.linux-tutorial.info/
¡¡¡¡http://www.freebsdforums.org/forums/
¡¡¡¡ ......
Ò»£® °²×°Sendmail¡£
ÍêÈ«°²×°Red Hat Linux
9.0ʱ£¬Sendmail¾Í»á×Ô¶¯ÄÚÖ㬰汾ºÅΪ8.12.8-4¡£Èç¹ûÄ㲻ȷ¶¨LinuxÊÇ·ñÒѾ°²×°ÓÐsendmail£¬¿ÉÒÔÊäÈëÒÔÏÂÃüÁî²é¿´£º
[root@ahpeng root] rpm –qa grep sendmail
Èç¹ûÈ·¶¨Ã»Óа²×°£¬ÇëÔÚÍ ......
Linux JDK and ANT install
linux JDKµÄ°²×°
°²×°JDK
´ÓsunÍøÕ¾ÉÏÖ±½ÓÏÂÔØJDK£ºhttp:
//java.sun.com/j2se/1.4.2
/download.htmlÌṩÁËÁ½¸öÏÂÔØ£º
1¡¢RPM in self-extracting file
(j2sdk-1_4_2_04-linux-i586.bin,
32.77 MB) Õâ¸öÊÇ×Ô½âѹµÄÎļþ£¬ÔÚlinuxÉϰ²×°ÈçÏ£º
chmod u+x
./j2sdk-1_4_2_04-l ......