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

linux ÄÚ´æ¹²ÏíÎÊÌâ - Linux/UnixÉçÇø / ³ÌÐò¿ª·¢Çø

ÓÐÁ½¸ö½ø³Ì, A ºÍ B ÓÃnmapʵÏÖ¹²Ïí, µ«Êǽá¹ûºÍÏëÏóµÄ²»Ò»Ñù

=================================================
A ½ø³Ì´úÂë

  int fd;  
  char *prt;  
  char *msg="My name is Foo!";  
  fd=open("sharefile",O_RDWR|O_CREAT,00777);  
  write(fd,msg,strlen(msg)+1);
  prt=(char*) mmap(NULL,strlen(msg)+1,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
  close(fd);  
   
  memcpy(prt,msg,strlen(msg)+1);  
  printf("%s\n",prt);  


  sleep(10); /*µÈ´ýbÈ¥Ð޸Ĺ²ÏíÄÚ´æÄÚÈÝ¡£*/  
  printf("%s",prt);  
   
  munmap(prt,strlen(msg)+1);


=====================================================
// B ½ø³Ì´úÂë

int fd; 
char *prt;
char *msg="My name is Bar!";
fd=open("sharefile",O_RDWR,00777);
prt=(char*) mmap(NULL,strlen(msg)+1,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
close(fd);
memcpy(prt,msg,strlen(msg)+1);
munmap(prt,strlen(msg));
=============================================

ÔÚÒ»¸ö¿ØÖÆ̨¿ªÆô½ø³ÌA ÔÚÁíÒ»¸ö¿ØÖÆ̨¿ªÆôB

AÏÔʾ½á¹ûÈçÏÂ, ºÍÏëÏóµÄ²»Ò»Ñù
My name is Foo!
My name is Foo!

½ø³ÌB µÄÔËÐжÔAûÓÐÆð×÷ÓÃ,


Çë·ÖÎöÔ­Òò,лл!





Ïà¹ØÎÊ´ð£º

linuxÏÂCÓïÑÔ¿ª·¢oracleµÄÎÊÌâ¡£

Á½¸öÎļþ1.PC£¬1.inc
1.PCÓвÙ×÷oracleÊý¾Ý¿âµÄ ,1.incÒ²ÓвÙ×÷oracleÊý¾Ý¿â 
ÔÚÆäËûÊý¾ÝÖÐÈçinformix ÖÐ$include 1.inc¾Í¿ÉÒÔʹÓÃÁË
ÔÚORACLEÊý¾Ý¿âÖØ $include 1.inc²»¿ÉÓà EXEC SQL include 1.incÒ²²»¿É ......

ÇóÖú linux¹Û¿´ÊÓƵÎÊÌâ

ÎÒÊÇlinux 5¡£4 redhat°æ±¾ ×°²»ÉÏadobe ÇóÖú¸÷λ¸ßÊÖÖ¸µã

  Ò»µãÐÅÏ¢¶¼²»¸ø Ë­ÖªµÀÔõô»ØÊ°¡
¶àÉÏÍøËÑËÑ °²×°Ö®Ç°ÏÈ¿´¿´Èí¼þµÄÒªÇóÒÔ¼°READMEµÈ˵Ã÷


32λ°æµÄÊÇ¿ÉÒÔ×°µÄ£¬64λµÄ»¹² ......

Linux -- pthread_mutex_lockÎÊÌâ - C/C++ / C++ ÓïÑÔ

int dValue = pthread_mutex_lock(&g_ThreadMutex);
if (0 != dValue)
{
. pthread_mutex_unlock(&g_ThreadMutex);
. return pToDealing;
}
----------------ʧ°Üºó£¬ÔÙµ÷ÓúìÉ«²¿·Ö£¬»á²»»áµ¼Ö³ÌÐ ......

QT linux open - Òƶ¯Æ½Ì¨ / Qt¿ª·¢

ÇëÎʸ÷룬ÎÒÏÖÔÚÐèÒªÔÚQTϵ÷ÓÃlinuxϵÄopenº¯Êý£¬ÇëÎʸ÷λ´óÏÀÔõôдѽ£¿
ÒòΪÎÒÐèÒªopenº¯Êý·µ»ØµÄfdÖ¸Õë
include ÏàÓ¦µÄÍ·Îļþ£¬QLibrary¼ÓÔØÏàÓ¦µÄ¿â£¬»òÕß¾²Ì¬Á¬½Ó½øÈ¥¡£
È»ºótypdef¶¨Ò庯ÊýÀàÐÍ£¬È»ºóinv ......

Çë½Ìlinux×é²¥ÎÊÌâ¡£ - Linux/UnixÉçÇø / ³ÌÐò¿ª·¢Çø

Îҵİå×ÓÓÃǶÈëʽlinuxϵͳ·¢ËÍ×é²¥°ü¸øÎÒPCÐéÄâ»úµÄlinux£¬ÐéÄâ»úµÄlinux¿ÉÒÔ½ÓÊÕµ½£¬µ«ÊÇͬÑùµÄ³ÌÐò£¬ÓÃÐéÄâ»úµÄlinux·¢ËÍ£¬Ç¶ÈëʽlinuxÈ´½ÓÊÕ²»µ½£¬¾ßÌå±íÏÖΪ×èÈûÔÚrecvfromº¯Êý¡£
´óÖÂÒѾ­¿ÉÒÔÅųýµÄÎÊÌ⣺
1 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ