LINUX ÄÚ´æÓ³Éä
ÔÚ³£¹æIOÖУ¬ÎÒÃÇÒ»°ã¶¼ÊÇÈÏΪºÍÎļþϵͳ×öIO²Ù×÷×ÜÊÇÎÞ·¨±ÜÃâµÄ±ØÐë²»ÑáÆä·³µÄwrite£¬read£¬¶øÊÂʵÉÏÕâÖÖ·½Ê½ÔÚ½øÐÐһЩ´óÎļþ²Ù×÷µÄʱºò£¬ÏÔµÃÊ®·ÖµÄ²»±ã£¬ÏÂÃæÕâ¶Î´úÂ뼴չʾÁËÈç¹û½«ÎïÀíÓ²ÅÌÉϵÄÊý¾ÝÓ³Éäµ½ÄÚ´æÖУ¬ÎÒÃÇÏñ²Ù×÷ÆÕͨµÄÄÚ´æÒ»Ñù¶ÔÎļþ½øÐжÁд£º
#include <sys/mman.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <string.h>
using namespace std;
main(int argc, char** argv) // map a normal file as shared mem:
{
int fd,i;
char *p_map;
char cs[]="helloworld";
fd=open( argv[1],O_CREAT|O_RDWR,00777 );
p_map = (char*)mmap(NULL,10,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
for(i = 0;i<10;i++)
{
cout << *(p_map+i);
}
memcpy(p_map,cs,10);
munmap(p_map,10);
}
½á¹ûÈçÏ£º
Administrator@GZHT-D1FF475D33 /LINUX/pro/hello
$ ./man1.exe cc
qwertyuiop
Administrator@GZHT-D1FF475D33 /LINUX/pro/hello
$ cat cc
helloworld
Ïà¹ØÎĵµ£º
ÔÚÓû§¿Õ¼ä£¬Ê¹ÓÃioctlϵͳµ÷ÓÃÀ´¿ØÖÆÉ豸£¬ÔÐÍÈçÏ£º
int ioctl(int fd, unsigned long cmd, ...);
µÚÈý¸ö²ÎÊý²»±íʾһ¸ö±äÊýÄ¿µÄ²ÎÊý£¬¶øÊÇÒ»¸öÀàÐÍ¿ÉÑ¡µÄ²ÎÊý¡£µÚÈý¸ö²ÎÊýÒÀÀµÓÚ¿ØÖÆÃüÁһЩÃüÁî²»ÓòÎÊý£¬Ò»Ð©ÓÃÒ»¸öÕûÊýÖµ£¬Ò»Ð©Ê¹ÓÃÖ¸Õë
1¡¢ioctlº¯Êý¶¨ÒåÃüÁî
ÔÚ±àдioctl´úÂë֮ǰ£¬Ê×ÏÈÐèÒª¶¨ÒåÃüÁΪÁË·ÀÖ¹ ......
ʲôÊÇÇý¶¯£¿
×îͨË׵ĽâÊ;ÍÊÇ“ÇýʹӲ¼þÉ豸Ðж¯”
×÷Óã¿
É豸Çý¶¯Óëµ×²ãÓ²¼þÖ±½Ó´ò½»µÀ£¬°´ÕÕÓ²¼þÉ豸µÄ¾ßÌ幤×÷·½Ê½¶ÁдÉ豸¼Ä´æÆ÷£¬Íê³ÉÉ豸µÄÂÖѯ¡¢Öжϴ¦Àí¡¢DMAͨÐÅ£¬½øÐÐÎïÀíÄÚ´æÏòÐéÄâÄÚ´æµÄÓ³É䣬×îÖÕʹͨÐÅÉ豸Äܹ»ÊÕ·¢Êý¾Ý£¬Ê¹ÏÔʾÉ豸Äܹ»ÏÔʾÎÄ×ÖºÍ»Ãæ£¬Ê¹´æ´¢É豸Äܹ»¼Ç¼ÎļþºÅÊý¾Ý
¼ÆË ......
Ê×ÏÈ£¬´Óhttp://java.sun.comÖÐÏÂÔØjdk,Îҵİ汾ÊÇjdk1.6.0_20
È»ºó£¬ÖÕ¶ËÊäÈë
´úÂë:
sudo chmod u+x /£¨Â·¾¶Ãû³Æ£©/jdk1.6.0_12.bin
ÐÞ¸ÄbinÎļþȨÏÞ£¬Ê¹Æä¿ÉÖ´ÐÐ
È»ºó£¬Ö´ÐÐ
´úÂë:
sudo £¨Â·¾¶Ãû³Æ£©/jdk1.6.0_20.bin
½«»á³öÏÖ×ÖÄ»£¬³ÖÐø°´»Ø³µ¼ü£¬Ö±ÖÁÆÁÄ»ÏÔʾҪÇóÊäÈë yes/no£¬´ËʱÊäÈëy»Ø³µ£¬½«»á°Ñjdk½âѹµ½Î ......