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

Linuxϳ£Óú¯Êý ÐźŴ¦Àíº¯Êý

alarm£¨ÉèÖÃÐźŴ«ËÍÄÖÖÓ£©  
Ïà¹Øº¯Êý   signal£¬sleep
±íÍ·Îļþ   #include<unistd.h>
¶¨Ò庯Êý   unsigned int alarm(unsigned int seconds);
º¯Êý˵Ã÷   alarm()ÓÃÀ´ÉèÖÃÐźÅSIGALRMÔÚ¾­¹ý²ÎÊýsecondsÖ¸¶¨µÄÃëÊýºó´«Ë͸øÄ¿Ç°µÄ½ø³Ì¡£Èç¹û²ÎÊýseconds Ϊ0£¬Ôò֮ǰÉèÖõÄÄÖÖӻᱻȡÏû£¬²¢½«Ê£ÏµÄʱ¼ä·µ»Ø¡£
·µ»ØÖµ   ·µ»Ø֮ǰÄÖÖÓµÄÊ£ÓàÃëÊý£¬Èç¹û֮ǰδÉèÄÖÖÓÔò·µ»Ø0¡£
·¶Àý   #include<unistd.h>
#include<signal.h>
void handler() {
printf(“hello\n”);
}
main()
{
int i;
signal(SIGALRM,handler);
alarm(5);
for(i=1;i<7;i++){
printf(“sleep %d ...\n”,i);
sleep(1);
}
}
Ö´ÐР  sleep 1 ...
sleep 2 ...
sleep 3 ...
sleep 4 ...
sleep 5 ...
hello
sleep 6 ...
kill£¨´«ËÍÐźŸøÖ¸¶¨µÄ½ø³Ì£©  
Ïà¹Øº¯Êý   raise£¬signal
±íÍ·Îļþ   #include<sys/types.h>
#include<signal.h>
¶¨Ò庯Êý   int kill(pid_t pid,int sig);
º¯Êý˵Ã÷   kill()¿ÉÒÔÓÃÀ´ËͲÎÊýsigÖ¸¶¨µÄÐźŸø²ÎÊýpidÖ¸¶¨µÄ½ø³Ì¡£²ÎÊýpidÓм¸ÖÖÇé¿ö:
pid>0 ½«ÐźŴ«¸ø½ø³Ìʶ±ðÂëΪpid µÄ½ø³Ì¡£
pid=0 ½«ÐźŴ«¸øºÍÄ¿Ç°½ø³ÌÏàͬ½ø³Ì×éµÄËùÓнø³Ì
pid=-1 ½«ÐźŹ㲥´«Ë͸øϵͳÄÚËùÓеĽø³Ì
pid<0 ½«ÐźŴ«¸ø½ø³Ì×éʶ±ðÂëΪpid¾ø¶ÔÖµµÄËùÓнø³Ì
²ÎÊýsig´ú±íµÄÐźűàºÅ¿É²Î¿¼¸½Â¼D
·µ»ØÖµ   Ö´Ðгɹ¦Ôò·µ»Ø0£¬Èç¹ûÓдíÎóÔò·µ»Ø-1¡£
´íÎó´úÂë   EINVAL ²ÎÊýsig ²»ºÏ·¨
ESRCH ²ÎÊýpid ËùÖ¸¶¨µÄ½ø³Ì»ò½ø³Ì×é²»´æÔÚ
EPERM ȨÏÞ²»¹»ÎÞ·¨´«ËÍÐźŸøÖ¸¶¨½ø³Ì
·¶Àý   #include<unistd.h>
#include<signal.h>
#include<sys/types.h>
#include<sys/wait.h>
main()
{
pid_t pid;
int status;
if(!(pid= fork())){
printf(“Hi I am child process!\n”);
sleep(10);
return;
}
else{
printf(“send signal to child process (%d) \n”,pid);
sleep(1);
kill(pid ,SIGABRT);
wait(&status);
if(WIFSIGNALED(status))
printf(“chile process receive signal %d\n”,WTERMSIG(status));
}
}
Ö´ÐР  sen signal to


Ïà¹ØÎĵµ£º

ÔÚlinuxÏÂʵÏÖweb qqµÄ×ÀÃ滯


´´½¨×ÀÃæͼ±ê
Ä¿Ç°½«ÍøÂçÓ¦ÓÃÀ©Õ¹µ½×ÀÃæÊÇÒ»¸öÇ÷ÊÆ£¬´æÔÚןܶà½â¾ö·½°¸£¬±¾ÎÄÒÔ Mozilla Prism ΪÀý£¬ÀàËƵķ½·¨Í¬ÑùÊÊÓÃÓÚ Google Chrome ¡£
1. µ½ Mozilla Prism µÄÍøÕ¾ÉÏÏÂÔØ Prism£¬µã»÷ Download Now Ö®ºó»áÌáʾÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÒÔ Mozilla Firefox À©Õ¹µÄ·½Ê½£¬ÊʺÏÒѾ­°²×°ÓÐ Firefox µÄÅóÓÑ£»Ò»Ö ......

linux ³£ÓÃÃüÁîÕûÀí

tar ÎļþÓëĿ¼ѹËõÃüÁî
tar [-cxtzjvfpPN] ÎļþÓëĿ¼ ....
²ÎÊý£º
-c £º½¨Á¢Ò»¸öѹËõÎļþµÄ²ÎÊýÖ¸Áî(create µÄÒâ˼)£»
-x £º½â¿ªÒ»¸öѹËõÎļþµÄ²ÎÊýÖ¸Á
-t £º²é¿´ tarfile ÀïÃæµÄÎļþ£¡
Ìرð×¢Ò⣬ÔÚ²ÎÊýµÄÏ´ïÖУ¬ c/x/t ½öÄÜ´æÔÚÒ»¸ö£¡²»¿Éͬʱ´æÔÚ£¡ÒòΪ²»¿ÉÄÜͬʱѹËõÓë½âѹËõ¡£
-z £ºÊÇ·ñͬʱ¾ßÓÐ gzip µÄ ......

Linuxϵͳµ÷Óà sigactionº¯ÊýÏê½â(Ò»)

¹¦ÄÜÃèÊö£º 
´¦ÀíÐźš£¼È¿ÉÓÃÓÚÉ趨¶ÔÈÎÒâÐźŵĴ¦Àí·½Ê½£¬Ò²¿ÉÓÃÓÚ¼ìÑé¸ÃÐźŵÄÄ¿Ç°Ô¤Éè´¦Ö÷½Ê½¡£
 
  
Ó÷¨£º 
#include <signal.h>
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
       
 &n ......

linuxͼÐνçÃæ±à³Ì»ù±¾ÖªÊ¶

ÒýÓÃ
×÷Õß:GuCuiwen email:win2linux@163.com
   ºÜ¶àLINUX³õѧÕß·Ö²»Çå³þlinuxºÍXÖ®¼ä,XºÍXfree86Ö®¼ä,XºÍKDE,GNOMEµÈÖ®¼äÊÇʲô¹Øϵ.³£³£»ìÏý¸ÅÄî,ÎÒÏëÒԱȽÏÒ×ÓÚÀí ½âµÄ·½Ê½ËµÃ÷Ò»ÏÂX,X11,XFREE,WM,KDE,GNOMEµÈÖ®¼äµÄ¹Øϵ.ÓÉÓÚ±¾ÈËˮƽÓÐÏÞ¿ÉÄÜ´æÔÚ´íÎó,Çë¸ßÊÖÖ¸Õý.
Ò»,linux±¾ÉíûÓÐͼÐνçÃæ,linuxÏÖÔÚµÄÍ ......

LinuxµÄInput Device

      Linux µÄ Input Device ÊÇÖØÒªµÄÒ»個 subsystem£¬ÔÚ進ÐÐ實Àý½é紹Ç°£¬ÏÈ´óÂÔÁ˽âÒ»ÏÂÏà關µÄ API¡£input.cÊÇLinuxµÄÊäÈë驅動³Ìʽ£¬Ö÷ÒªÖ§Ô®鍵盤與»¬ÊóµÄ輸È룻input.c½éÃæÌØÊâµÄµØ·½ÊÇ採ÓÃÁËʼþ£¨event£©µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ