LinuxÄں˵Äioctlº¯Êýѧϰ
ÎÒÕâÀï˵µÄioctlº¯ÊýÊÇÔÚÇý¶¯³ÌÐòÀïµÄ£¬ÒòΪÎÒ²»ÖªµÀ»¹ÓÐûÓбðµÄ³¡ºÏÓõ½ÁËioctl£¬ ËùÒԾ͹涨ÁËÎÒÃÇÌÖÂ۵ķ¶Î§¡£ÎªÊ²Ã´ÒªÐ´ÆªÎÄÕÂÄØ£¬ÊÇÒòΪÎÒÇ°Ò»Õó×Ó±»ioctl¸ø¸ã»ìÁË£¬Õ⼸Ìì²ÅŪÃ÷°×Ëü£¬ÓÚÊÇÔÚÕâÀïÇåÀíÒ»ÏÂÍ·ÄÔ¡£
Ò»¡¢ ʲôÊÇioctl¡£
ioctlÊÇÉ豸Çý¶¯³ÌÐòÖжÔÉ豸µÄI/OͨµÀ½øÐйÜÀíµÄº¯Êý¡£Ëùν¶ÔI/OͨµÀ½øÐйÜÀí£¬¾ÍÊǶÔÉ豸µÄһЩÌØÐÔ½øÐпØÖÆ£¬ÀýÈç´®¿ÚµÄ´«Ê䲨ÌØÂÊ¡¢Âí´ïµÄתËٵȵȡ£ËüµÄµ÷ÓøöÊýÈçÏ£º
int ioctl(int fd, ind cmd, …)£»
ÆäÖÐfd¾ÍÊÇÓû§³ÌÐò´ò¿ªÉ豸ʱʹÓÃopenº¯Êý·µ»ØµÄÎļþ±êʾ·û£¬cmd¾ÍÊÇÓû§³ÌÐò¶ÔÉ豸µÄ¿ØÖÆÃüÁÖÁÓÚºóÃæµÄÊ¡ÂԺţ¬ÄÇÊÇһЩ²¹³ä²ÎÊý£¬Ò»°ã×î¶àÒ»¸ö£¬ÓлòûÓÐÊǺÍcmdµÄÒâÒåÏà¹ØµÄ¡£
ioctlº¯ÊýÊÇÎļþ½á¹¹ÖеÄÒ»¸öÊôÐÔ·ÖÁ¿£¬¾ÍÊÇ˵Èç¹ûÄãµÄÇý¶¯³ÌÐòÌṩÁ˶ÔioctlµÄÖ§³Ö£¬Óû§¾Í¿ÉÒÔÔÚÓû§³ÌÐòÖÐʹÓÃioctlº¯Êý¿ØÖÆÉ豸µÄI/OͨµÀ¡£
¶þ¡¢ ioctlµÄ±ØÒªÐÔ
Èç¹û²»ÓÃioctlµÄ»°£¬Ò²¿ÉÒÔʵÏÖ¶ÔÉ豸I/OͨµÀµÄ¿ØÖÆ£¬µ«ÄǾÍÊÇÂùÅ¡ÁË¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚÇý¶¯³ÌÐòÖÐʵÏÖwriteµÄʱºò¼ì²éÒ»ÏÂÊÇ·ñÓÐÌØÊâ Ô¼¶¨µÄÊý¾ÝÁ÷ͨ¹ý£¬Èç¹ûÓеĻ°£¬ÄÇôºóÃæ¾Í¸ú×Å¿ØÖÆÃüÁһ°ãÔÚsocket±à³ÌÖг£³£ÕâÑù×ö£©¡£µ«ÊÇÈç¹ûÕâÑù×öµÄ»°£¬»áµ¼Ö´úÂë·Ö¹¤²»Ã÷£¬³ÌÐò½á¹¹»ì ÂÒ£¬³ÌÐòÔ±×Ô¼ºÒ²»áÍ·»èÑÛ»¨µÄ¡£
ËùÒÔ£¬ÎÒÃǾÍʹÓÃioctlÀ´ÊµÏÖ¿ØÖƵŦÄÜ¡£Òª¼Çס£¬Óû§³ÌÐòËù×÷µÄÖ»ÊÇͨ¹ýÃüÁîÂë¸æËßÇý¶¯³ÌÐòËüÏë×öʲô£¬ÖÁÓÚÔõô½âÊÍÕâЩÃüÁîºÍÔõôʵÏÖÕâЩÃüÁÕⶼÊÇÇý¶¯³ÌÐòÒª×öµÄÊÂÇé¡£
Èý¡¢ ioctlÈçºÎʵÏÖ
ÕâÊÇÒ»¸öºÜÂé·³µÄÎÊÌ⣬ÎÒÊÇÄÜÊ¡ÔòÊ¡¡£ÒªËµÇå³þËü£¬Ã»ÓÐËÄÎåǧ×ÖÊDz»Ðеģ¬ËùÒÔÎÒÕâÀïÊDz»¿ÉÄÜ°ÑËü˵µÃ·Ç³£Çå³þÁË£¬²»¹ýÈç¹ûÓжÁÕ߶ÔÓû§³ÌÐòÔõôºÍ Çý¶¯³ÌÐòÁªÏµÆðÀ´¸ÐÐËȤµÄ»°£¬¿ÉÒÔ¿´ÎÒÇ°Ò»Õó×ÓдµÄ¡¶writeµÄ°ÂÃØ¡·¡£¶ÁÕßÖ»Òª°Ñwrite»»³Éioctl£¬¾ÍÖªµÀÓû§³ÌÐòµÄioctlÊÇÔõôºÍÇý¶¯ ³ÌÐòÖеÄioctlʵÏÖÁªÏµÔÚÒ»ÆðµÄÁË¡£
ÎÒÕâÀï˵һ¸ö´ó¸Å˼·£¬ÒòΪÎÒ¾õµÃ¡¶LinuxÉ豸Çý¶¯³ÌÐò¡·Õâ±¾ÊéÒѾ˵µÄ·Ç³£Çå³þÁË£¬µ«Êǵû¯Ò»Ð©Ê±¼äÀ´¿´¡£
ÔÚÇý¶¯³ÌÐòÖÐʵÏÖµÄioctlº¯ÊýÌåÄÚ£¬Êµ¼ÊÉÏÊÇÓÐÒ»¸öswitch{case}½á¹¹£¬Ã¿Ò»¸öcase¶ÔÓ¦Ò»¸öÃüÁîÂ룬×ö³öһЩÏàÓ¦µÄ²Ù×÷¡£Ôõôʵ ÏÖÕâЩ²Ù×÷£¬ÕâÊÇÿһ¸ö³ÌÐòÔ±×Ô¼ºµÄÊÂÇ飬ÒòΪÉ豸¶¼ÊÇÌض¨µÄ£¬ÕâÀïҲû·¨Ëµ¡£¹Ø¼üÔÚÓÚÔõôÑù×éÖ¯ÃüÁîÂ룬ÒòΪÔÚioctlÖÐÃüÁîÂëÊÇΨһÁªÏµÓû§³ÌÐòÃü ÁîºÍÇý¶¯³ÌÐòÖ§³ÖµÄ;¾¶¡£
ÃüÁîÂëµÄ×éÖ¯ÊÇÓÐһЩ½²¾¿µÄ£¬ÒòΪÎÒÃÇÒ»¶¨Òª×öµ½ÃüÁîºÍÉ豸ÊÇÒ»Ò»¶ÔÓ¦µÄ£¬
Ïà¹ØÎĵµ£º
ÓÉÓÚÎҵĻúÆ÷ż¶û¿ª·¢Óã¬ËùÒÔ¿â±È½ÏÈ«¡£
ËùÒÔÈç¹ûÄú°²×°µÄʱºò£¬È±É¶²¹É¶°É~~
careone ´òdeb°ü~~
ÏÂÔØÒ³Ã棺http://forum.ubuntu.org.cn/viewtopic.php?f=137&t=217474
ÏÂÔصØÖ·£ºhttp://forum.ubuntu.org.cn/download/file.php?id=73080 ......
LinuxµÄ±äÁ¿¿É·ÖΪÁ½Àࣺ»·¾³±äÁ¿ºÍ±¾µØ±äÁ¿
»·¾³±äÁ¿£¬»òÕß³ÆΪȫ¾Ö±äÁ¿£¬´æÔÚÓëËùÓеÄshellÖУ¬ÔÚÄãµÇ½ϵͳµÄʱºò¾ÍÒѾÓÐÁËÏàÓ¦µÄϵͳ¶¨ÒåµÄ»·¾³±äÁ¿ÁË¡£LinuxµÄ»·¾³±äÁ¿¾ßÓм̳ÐÐÔ£¬¼´×Óshell»á¼Ì³Ð¸¸shellµÄ»·¾³±äÁ¿¡£
±¾µØ±äÁ¿£¬µ±Ç°shellÖеıäÁ¿£¬ºÜÏÔÈ»±¾µØ±äÁ¿Öп϶¨°üº¬»·¾³±äÁ¿¡£LinuxµÄ±¾µØ±äÁ¿µÄ·Ç»·¾³± ......
¹ØÓÚÐÂÓ²Å̵ĹÒÔØÖ÷ÒªÓм¸¸ö²½×ࣺ£¨ÎÒÓõÄÊÇUbuntu9.10£©
Ò».Ê×ÏȲ鿴×Ô¼ºµÄÉ豸£¬ÓÃÃüÁî fdisk -l
youlong@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 51 ......
ÏÈÈ«¾Ö½éÉÜÏ£¬Ê×ÏÈ£¬Ê²Ã´ÊÇOpenGLºÍOpenGL|ES¡£OpenGLÊÇÒ»Ì×»æͼº¯ÊýµÄ±ê×¼£¬OpenGL|ESÊÇOpenGLÖÐÕë¶ÔǶÈëʽϵͳµÄÒ»Ì׺¯Êý×Ó¼¯¡£OpenGL|ESµÄ¹Ù·½ÊÇhttp://www.khronos.org/opengles/£¬ÉÏÃæÓиü¶àµÄÐÅÏ¢¡£ÐèҪעÒâµÄÊÇ£¬OpenGL½ö½öÊDZê×¼£¬¶øÈç¹ûÄãҪʹÓÃOpenGL£¬ÔòÐèÒªÕÒµ½¿ÉÒÔʵÏÖÕâЩOpenGL±ê×¼º¯ÊýµÄ³ÌÐò¿â»òÔ´´úÂë¡£Ä ......
linuxÈçºÎϵͳÐÅÏ¢
Äõ½Ò»¸öϵͳ£¬¿Ï¶¨Òª¿´¿´ÏµÍ³ÅäÖã¬linuxÏ¿´ÅäÖ㬿ÉûÓÐwindowsÄÇôֱ¹Û¡£ÄãÖ»ÄÜÒ»¸öÒ»¸ö²é¿´¡£
Ò»£ºcpu
[root@srv /]# more /proc/cpuinfo | grep "model name"
model name : Intel(R) Xeon(R) CPU X3220 @ 2.40GHz
model name &n ......