LinuxÉ豸Çý¶¯¿ª·¢Ïê½â ±Ê¼Ç6 ×Ö·ûÉ豸Çý¶¯
ʹÓÃÏÂÁкé¿ÉÒÔͨ¹ýÖ÷É豸ºÅºÍ´ÎÉ豸ºÅÉú³Édev_t
MKDEV(int major, int mainor)
Èç¹û¸´ÖƵÄÄÚ´æÊǼòµ¥ÀàÐÍ£¬Èçchar¡¢int¡¢longµÈ£¬Ôò¿ÉÒÔʹÓüòµ¥µÄput_user()ºÍget_user()
Linuxϵͳ½¨ÒéÒÔÈçͼ·½Ê½¶¨ÒåioctlÃüÁîÂë
ÃüÁËÂëµÄÉ豸ÀàÐÍ×Ö¶ÎΪһ¸ö“»ÃÊý”£¬¿ÉÒÔÊÇ0-0xffÖ®¼äµÄÖµ£¬ÄÚºËÖеÄioctl-number.txt¸ø³öÁËһЩÍƼöµÄºÍÒѾʹÓÃÁ˵ē»ÃÊý”£¬ÐÂÉ豸Çý¶¯¶¨Òå“»ÃÊý”µÄʱºòÒª±ÜÃâÓëÆä·¢Éú³åÍ»¡£
ÃüÁîÂëµÄ·½Ïò×Ö¶ÎΪ2룬¸Ã×ֶαíʾÊý¾Ý´«Ë͵ķ½Ïò£¬¿ÉÄܵÄÖµÊÇ_IOC_NONE£¨ÎÞÊý¾Ý´«Ê䣩¡¢_IOC_READ£¨¶Á£©¡¢_IOC_WRITE£¨Ð´£©ºÍ_IOC_READ|_IOC_WRITE£¨Ë«Ïò£©¡£Êý¾Ý´«Ë͵ķ½ÏòÊÇ´ÓÓ¦ÓóÌÐòµÄ½Ç¶ÈÀ´¿´µÄ
ÃüÁîÂëµÄÊý¾Ý³¤¶È×ֶαíʾÉæ¼°µÄÓû§Êý¾ÝµÄ´óС£¬Õâ¸ö³ÉÔ±µÄ³¤¶Èͨ³£ÒÀÀµÓÚÌåϵ½á¹¹£¬Í¨³£ÊÇ13λ»òÕß14λ
Äں˻¹¶¨ÒåÁË_IO()¡¢_IOR()¡¢_IOW()ºÍ_IOWR()ÕâËĸöºêÀ´¸¨ÖúÉú³ÉÃüÁî
ÄÚºËÖÐÔ¤¶¨ÒåÁËһЩio¿ØÖÆÃüÁÈç¹ûijÉ豸Çý¶¯Öаüº¬ÁËÓëÔ¤¶¨ÒåÃüÁîÒ»ÑùµÄÃüÁÕâЩÃüÁî»á±»µ±×öÔ¤¶¨ÒåÃüÁî±»Äں˴¦Àí¶ø²»ÊDZ»É豸Çý¶¯´¦Àí£¬Ô¤¶¨ÒåÃüÁîÓÐÈçÏÂ4ÖÖ£º
FIOCLEX FIONCLEX FIOQSIZE FIONBIO p142
dev = container_of(inode->i_cdev, struct globalmem_dev, cdev);
container_ofµÄ×÷ÓÃÊÇͨ¹ý½á¹¹Ìå³ÉÔ±µÄÖ¸ÕëÕÒµ½¶ÔÓ¦½á¹¹ÌåµÄÖ¸Õ룬Õâ¸ö¼¼ÇÉÔÚLinuxÄں˱à³ÌÖÐÊ®·ÖÓг£ÓᣵÚ1¸ö²ÎÊýÊǽṹÌå³ÉÔ±µÄÖ¸Õ룬µÚ2¸ö²ÎÊýΪÕû¸ö½á¹¹ÌåµÄÀàÐÍ£¬µÚ3¸ö²ÎÊýΪ´«ÈëµÄµÚ1¸ö²ÎÊý£¨½á¹¹Ìå³ÉÔ±£©µÄÀàÐÍ£¬·µ»ØÕû¸ö½á¹¹ÌåµÄÖ¸Õë
Ïà¹ØÎĵµ£º
ÕâÁ½Ìì´î½¨ÁËÒ»×éApache·þÎñÆ÷£¬Ã¿Ì¨·þÎñÆ÷4GÄڴ棬²ÉÓõÄÊÇpreforkģʽ£¬Ò»¿ªÊ¼ÉèÖõÄÁ¬½ÓÊýÌ«ÉÙÁË£¬ÐèÒª½Ï³¤µÄʱ¼äÈ¥ÏìÓ¦Óû§µÄÇëÇ󣬺óÀ´ÐÞ¸ÄÁËÒ»ÏÂApache 2.0.59µÄÅäÖÃÎļþhttpd.conf£º
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes ......
ʲôÊÇÇý¶¯£¿
×îͨË׵ĽâÊ;ÍÊÇ“ÇýʹӲ¼þÉ豸Ðж¯”
×÷Óã¿
É豸Çý¶¯Óëµ×²ãÓ²¼þÖ±½Ó´ò½»µÀ£¬°´ÕÕÓ²¼þÉ豸µÄ¾ßÌ幤×÷·½Ê½¶ÁдÉ豸¼Ä´æÆ÷£¬Íê³ÉÉ豸µÄÂÖѯ¡¢Öжϴ¦Àí¡¢DMAͨÐÅ£¬½øÐÐÎïÀíÄÚ´æÏòÐéÄâÄÚ´æµÄÓ³É䣬×îÖÕʹͨÐÅÉ豸Äܹ»ÊÕ·¢Êý¾Ý£¬Ê¹ÏÔʾÉ豸Äܹ»ÏÔʾÎÄ×ֺͻÃ棬ʹ´æ´¢É豸Äܹ»¼Ç¼ÎļþºÅÊý¾Ý
¼ÆË ......
´¦ÀíÆ÷µÄ·ÖÀ࣬ÈçÏÂͼËùʾ£º
´æ´¢Æ÷¿É·ÖΪֻ¶Á´æ´¢Æ÷£¨ROM£©¡¢ÉÁ´æ£¨Flash£©¡¢Ëæ»ú´æÈ¡´æ´¢Æ÷£¨RAM£©¡¢¹â½éÖÊ´æ´¢Æ÷ºÍ´Å½éÖÊ´æ´¢Æ÷
Nor FlashºÍcpuµÄ½Ó¿ÚÊôÓÚµäÐ͵ÄÀàSRAM½Ó¿Ú£¬²»ÐèÒªÔö¼Ó¶îÍâµÄ¿ØÖƵç·¡£Nor FlashµÄÌصãÊÇ¿ÉоƬÄÚÖ´ÐУ¬³ÌÐò¿ÉÒÔÖ±½ÓÔÚNorÄÚÔËÐС£¶øNand FashºÍcpuµÄ½Ó¿Ú±ØÐëÓÉÏàÓ¦µÄ¿ØÖƵç·½øÐÐת»»£ ......
ÔÚÉ豸Çý¶¯·½Ã棬Linux2.6Ïà¶ÔÓÚLinux2.4ÓнϴóµÄ¸Ä¶¯£¬ÕâÖ÷Òª±íÏÖÔÚÄÚºËAPIÖÐÔö¼ÓÁ˲»ÉÙй¦ÄÜ£¨ÈçÄÚ´æ³Ø£©¡¢sysfsÎļþϵͳ¡¢ÄÚºËÄ£¿é´Ó.o±äΪ.ko¡¢Çý¶¯Ä£¿é±àÒ뷽ʽ¡¢Ä£¿éʹÓüÆÊý¡¢Ä£¿é¼ÓÔغÍжÔغ¯ÊýµÄ¶¨ÒåµÈ·½Ãæ
LinuxÄÚºËÖ÷ÒªÓнø³Ìµ÷¶È¡¢ÄÚ´æ¹ÜÀí¡¢ÐéÄâÎļþϵͳ¡¢ÍøÂç½Ó¿ÚºÍ½ø³Ì¼äͨÐŵÈ5¸ö×Óϵͳ×é³É£¬ÈçÏÂͼ£º
......