Ò»¸ö¹ØÓÚlinuxµÄÐźÅÁ¿¼¯µÄÎÊÌâ
#include <sys/sem.h>
#include <sys/ipc.h>
#include <stdio.h>
union semun{
int val;
struct semid_ds *buf;
unsigned short *array;
}
main()
{
int semid;
semid=semget(IPC_PRIVATE,2,IPC_CREAT|0666);
union semun sem,sem2;
sem.val=1;
sem2.val=0;
semctl(semid,0,SETVAL,sem);
semctl(semid,1,SETVAL,sem2);
if(fork()==0)
{int i;
struct sembuf sops={0,+1,IPC_NOWAIT},sops2={1,-1,IPC_NOWAIT};
for(i=0;i <1000;i++)
{
semop(semid,&sops,1);
printf("a\n");
semop(semid,&sops2,1);
}
}
else
{
int j;
struct sembuf sops={0,-1,IPC_NOWAIT},sops2={1,+1,IPC_NOWAIT};
for(j=0;j <1000;j++)
{
semop(semid,&sops2,1);
printf("b\n");
semop(semid,&sops,1);
}
}
}
ÏëҪʵÏÖababababµÄÊä³ö£¬¿ÉÊǺÃÏñ²»ÐУ¬½á¹ûÊÇÏÈÊä³öa£¬ÔÚÊä³öb,ÄÄÀï²»¶ÔÂð£¬ÇëÎÊÒ»ÏÂ
²»¼Ó¿ØÖƾÍÊÇËæ»úµÄ
¿ÉÊÇÎÒÒѾÓÃÐźÅÁ¿¼¯À´¿ØÖÆÁË°¡£¬ÊDz»ÊÇÄǼ¸¸öPVº¯ÊýÓôíÁË°¡£¬ÎÒ²»´ó»áÓÃ
#include <sys/sem.h>
#include <sys/ipc.h>
#include <stdio.h>
union semun{
int val;
struct semid_ds *buf;
unsigned short *array;
}
main()
{
int semid;
semid=semget(IPC_PRIVATE,2,IPC_CREAT|0666);
union semun sem,sem2;
sem.val=0;
Ïà¹ØÎÊ´ð£º
Á½Ì¨»úÆ÷ÐͺÅÍêÈ«Ò»Ñù
ÏëÒª°Ñһ̨»úÆ÷µÄÄÚºËÅäÖÃÎļþ¿½±´¸øÁíÍâһ̨
RT
3Q
...
.config Òþ²ØµÄ ÔÚÄãÅäÖùýÄں˺ó¾ÍÉú³ÉÁË
lsÕý½â£¬ÔÚkernelÔ´Â붥²ãĿ¼ÖÐÓиö.configÎļþ£¬ÅäÖ ......
ÒòΪ°²×°cvsÒªÓõ½xinetd·þÎñ£¬·¢ÏÖ»úÆ÷ÉÏûÓС£¡£¾Í´ÓÍøÉÏÏÂÔØÁ˸ö×°ÉÏ£¬
SQL code:
[root@localhost ~]# rpm -qa xinetd
[root@localhost ~]# rpm -qa telnet
telnet-0.17-38.el5
[root@localhost ~]#
¸ ......
ʹÓÃPHPµÄexecº¯Êýµ÷ÓÃlinuxµÄshellÃüÁÈçdateÈ¥ÐÞ¸Äʱ¼ä»òshutdownȥʵÏֹػú/ÖØÆô£¬µ«ÊÇ·µ»ØÖµ¶¼ÊÇʧ°ÜµÄ¡£¾¹ý¶à´ÎÊÔÑ飬È϶¨ÊÇûÓÐȨÏÞµÄÎÊÌâ¡£
ËùÒÔ£¬Ð¡µÜÔÚ´ËÇë½Ì¸÷룬ÈçºÎ²ÅÄÜÉèÖÃȨÏÞ£¬µ÷ÓÃlinux shellà ......
ÎÒÓùýubuntu8.10°æ±¾£¬´ÓverycdÏÂÔصġ£
ÏÂÔغó£¬ÊÇ°ëÓ¢ÎÄ¡£ÇÒÎÒ¶ÔlinuxϵͳµÄ²Ù×÷Àí½â²»ÉÒò´Ë×°ÖÐÎÄÊäÈë·¨¶¼¸ãÁ˺þá£
È»ºó°´ÕÕÍøÉϵĽ̸̳üÐÂÖÐÎĽçÃ棬µ«ÊǸüÐÂÁË1ÍíÉϺóÌáʾÖжϡ¡Àס£
......
СµÜ×î½üÐèÒªÒ»¸öÓÃsocket»ñÈ¡htmlÎĵµµÄ´úÂ룬µ«ÊÇÀÏÊDz»ÄÜ»ñÈ¡ÍêÕûµÄhtmlÔ´Âë¡£ÔÒò²»Ã÷£¬Íû¸ßÊÖÖ¸µã£¡
C/C++ code:
char *Http_GET(char *host,int port,char *data) //·¢ËÍGETÇëÇó
{
char response[2 ......