Linux mmap
LinuxÌṩÁËÄÚ´æÓ³É亯Êýmmap, Ëü°ÑÎļþÄÚÈÝÓ³Éäµ½Ò»¶ÎÄÚ´æÉÏ(׼ȷ˵ÊÇÐéÄâÄÚ´æÉÏ), ͨ¹ý¶ÔÕâ¶ÎÄÚ´æµÄ¶ÁÈ¡ºÍÐÞ¸Ä, ʵÏÖ¶ÔÎļþµÄ¶ÁÈ¡ºÍÐÞ¸Ä, ÏÈÀ´¿´Ò»ÏÂmmapµÄº¯ÊýÉùÃ÷: Í·Îļþ: ÔÐÍ: void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offsize); ·µ»ØÖµ: ³É¹¦Ôò·µ»ØÓ³ÉäÇøÆðʼµØÖ·, ʧ°ÜÔò·µ»ØMAP_FAILED(-1). ²ÎÊý: addr: Ö¸¶¨Ó³ÉäµÄÆðʼµØÖ·, ͨ³£ÉèΪNULL, ÓÉϵͳָ¶¨. length: ½«ÎļþµÄ¶à´ó³¤¶ÈÓ³Éäµ½ÄÚ´æ. prot: Ó³ÉäÇøµÄ±£»¤·½Ê½, ¿ÉÒÔÊÇ: PROT_EXEC: Ó³ÉäÇø¿É±»Ö´ÐÐ. PROT_READ: Ó³ÉäÇø¿É±»¶ÁÈ¡. PROT_WRITE: Ó³ÉäÇø¿É±»Ð´Èë. PROT_NONE: Ó³ÉäÇø²»ÄÜ´æÈ¡. flags: Ó³ÉäÇøµÄÌØÐÔ, ¿ÉÒÔÊÇ: MAP_SHARED: ¶ÔÓ³ÉäÇøÓòµÄдÈëÊý¾Ý»á¸´ÖÆ»ØÎļþ, ÇÒÔÊÐíÆäËûÓ³Éä¸ÃÎļþµÄ½ø³Ì¹²Ïí. MAP_PRIVATE: ¶ÔÓ³ÉäÇøÓòµÄдÈë²Ù×÷»á²úÉúÒ»¸öÓ³ÉäµÄ¸´ÖÆ(copy-on-write), ¶Ô´ËÇøÓòËù×öµÄÐ޸IJ»»áд»ØÔÎļþ. ´ËÍ⻹ÓÐÆäËû¼¸¸öflags²»ºÜ³£ÓÃ, ¾ßÌå²é¿´linux Cº¯Êý˵Ã÷. fd: ÓÉopen·µ»ØµÄÎļþÃèÊö·û, ´ú±íÒªÓ³ÉäµÄÎļþ. offset: ÒÔÎļþ¿ªÊ¼´¦µÄÆ«ÒÆÁ¿, ±ØÐëÊÇ·ÖÒ³´óСµÄÕûÊý±¶, ͨ³£Îª0, ±íʾ´ÓÎļþÍ·¿ªÊ¼Ó³Éä. ÏÂÃæËµÒ»ÏÂÄÚ´æÓ³ÉäµÄ²½Öè: ÓÃopenϵͳµ÷Óôò¿ªÎļþ, ²¢·µ»ØÃèÊö·ûfd. ÓÃmmap½¨Á¢ÄÚ´æÓ³Éä, ²¢·µ»ØÓ³ÉäÊ×µØÖ·Ö¸Õëstart. ¶ÔÓ³Éä(Îļþ)½øÐи÷ÖÖ²Ù×÷, ÏÔʾ(printf), ÐÞ¸Ä(sprintf). ÓÃmunmap(void *start, size_t lenght)¹Ø±ÕÄÚ´æÓ³Éä. ÓÃcloseϵͳµ÷ÓùرÕÎļþfd. ×¢ÒâÊÂÏî: ÔÚÐÞ¸ÄÓ³ÉäµÄÎļþʱ, Ö»ÄÜÔÚÔ³¤¶ÈÉÏÐÞ¸Ä, ²»ÄÜÔö¼ÓÎļþ³¤¶È, ÒòΪÄÚ´æÊÇÒѾ·ÖÅäºÃµÄ.
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
×î½üÓиöÏîĿҪ²¿Êðµ½linuxÉÏ£¬ÔÚÍøÉϲéÁËЩ×ÊÁÏ£¬¼ÇϵãÓöµ½µÄÎÊÌ⣬ÒԱ㽫À´ÔÙÓá£
Ò»£ºjdk°²×°
1.ͨ¹ýchmod a+x jdk-1_5_x-rc-linux-i586-rpm.binÃüÁîʹÆä»ñµÃ¿ÉÖ´ÐÐȨÏÞ
2.ͨ¹ý rpm –ivh jdk-1_5_x-rc-linux-i586-rpm.binÀ´½øÐа²×°
3.°²×°Íê±Ï,JDK°²×°ÔÚ/usr/java/Ŀ¼ÏÂ
4.ÉèÖû·¾³±äÁ¿(дÈëvi/etc/ ......
LinuxÕÊ»§µÄÃÜÂë¼ÓÃÜºó´æ·ÅÓÚ/etc/shadowÎļþÖС£¶ÔÓÚRedhat Enterprise°æ±¾£¬Ä¬ÈÏʹÓÃMD5Ëã·¨£¬Õâ¸öËã·¨ÒѾºÜ²»°²È«¡£ºÜ¶à¾µäµÄºÚ¿Í½Ì³Ì¶¼ÊǽÌÈËÄõ½shadowÎļþºó»ØÈ¥ÆÆ½â³örootµÄÃÜÂ룬Èç¹ûÄÜÓøüÄÑÆÆ½âµÄshaËã·¨¼ÓÃÜÃÜÂëÎÞÒÉ¿ÉÒÔÌá¸ß·þÎñÆ÷µÄ°²È«ÐÔ¡£ÒÔÏÂÄÚÈÝÊÇ×ÛºÏÁËhttp://www.cyberciti.biz/faq/rhel-centos-fedora ......
ÏȼòÒª½éÉÜÏÂddµÄ²ÎÊý£¬ºó±ßͨ¹ý¼¸¸öʵÀý½éÉÜddµÄÓ¦Ó㬲ο¼ÁËÆäËûÍøÓѵÄ×ÊÁÏ£¬ÔÚ´ËÒ»
²¢¸Ðл£¬Ë®Æ½ÓÐÏÞÎÄÖÐÓÐʲô´íÎóÇë´ó¼ÒÖ¸Õý¡£
dd ÊÇ Linux/UNIX ϵÄÒ»¸ö·Ç³£ÓÐÓõÄÃüÁ×÷ÓÃÊÇÓÃÖ¸¶¨´óСµÄ¿é¿½±´Ò»¸öÎļþ£¬²¢ÔÚ¿½±´
µÄͬʱ½øÐÐÖ¸¶¨µÄת»»¡£
1. ÃüÁî¼ò½é
dd µÄÖ÷ҪѡÏ
Ö¸¶¨Êý×ֵĵط½ÈôÒÔÏÂÁÐ×Ö·û½áβ³ËÒÔÏ ......