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

Linux shell I/OÖØ¶¨ÏòÏê½â

 I/OÖØ¶¨ÏòÏê½â¼°Ó¦ÓÃʵÀý
1¡¢ »ù±¾¸ÅÄÕâÊÇÀí½âºóÃæµÄ֪ʶµÄǰÌᣬÇëÎñ±ØÀí½â£©
a¡¢ I/OÖØ¶¨Ïòͨ³£Óë FDÓйأ¬shellµÄFDͨ³£Îª10¸ö£¬¼´ 0¡«9£»
b¡¢ ³£ÓÃFDÓÐ3¸ö£¬Îª0£¨stdin£¬±ê×¼ÊäÈ룩¡¢1£¨stdout£¬±ê×¼Êä³ö£©¡¢2£¨stderr£¬±ê×¼´íÎóÊä³ö£©£¬Ä¬ÈÏÓëkeyboard¡¢monitor¡¢monitorÓйأ»
c¡¢ Óà < À´¸Ä±ä¶Á½øµÄÊý¾ÝÐŵÀ(stdin)£¬Ê¹Ö®´ÓÖ¸¶¨µÄµµ°¸¶Á½ø£»
d¡¢ Óà > À´¸Ä±äËͳöµÄÊý¾ÝÐŵÀ(stdout, stderr)£¬Ê¹Ö®Êä³öµ½Ö¸¶¨µÄµµ°¸£»
e¡¢ 0 ÊÇ < µÄĬÈÏÖµ£¬Òò´Ë < Óë 0<ÊÇÒ»ÑùµÄ£»Í¬Àí£¬> Óë 1> ÊÇÒ»ÑùµÄ£»
f¡¢ ÔÚIOÖØ¶¨Ïò ÖУ¬stdout Óë stderr µÄ¹ÜµÀ»áÏÈ×¼±¸ºÃ£¬²Å»á´Ó stdin ¶Á½ø×ÊÁÏ£»
g¡¢ ¹ÜµÀ“|”(pipe line):ÉÏÒ»¸öÃüÁîµÄ stdout ½Óµ½ÏÂÒ»¸öÃüÁîµÄ stdin;
h¡¢ tee ÃüÁîÊÇÔÚ²»Ó°ÏìÔ­±¾ I/O µÄÇé¿öÏ£¬½« stdout ¸´ÖÆÒ»·Ýµ½µµ°¸È¥;
i¡¢ bash£¨ksh£©Ö´ÐÐÃüÁîµÄ¹ý³Ì£º·ÖÎöÃüÁ±äÁ¿ÇóÖµ£­ÃüÁîÌæ´ú£¨``ºÍ$( )£©£­Öض¨Ïò£­Í¨Åä·ûÕ¹¿ª£­È·¶¨Â·¾¶£­Ö´ÐÐÃüÁ
j¡¢ ( ) ½« command group ÖÃÓÚ sub-shell È¥Ö´ÐУ¬Ò²³Æ nested sub-shell£¬ËüÓÐÒ»µã·Ç³£ÖØÒªµÄÌØÐÔÊÇ£º¼Ì³Ð¸¸shellµÄStandard input, output, and error plus any other open file descriptors¡£
k¡¢ exec ÃüÁ³£ÓÃÀ´Ìæ´úµ±Ç° shell ²¢ÖØÐÂÆô¶¯Ò»¸ö shell£¬»»¾ä»°Ëµ£¬²¢Ã»ÓÐÆô¶¯×Ó shell¡£Ê¹ÓÃÕâÒ»ÃüÁîʱÈκÎÏÖÓл·¾³¶¼½«»á±»Çå³ý¡£exec ÔÚ¶ÔÎļþÃèÊö·û½øÐвÙ×÷µÄʱºò£¬Ò²Ö»ÓÐÔÚÕâʱ£¬exec ²»»á¸²¸ÇÄ㵱ǰµÄ shell »·¾³¡£
2¡¢ »ù±¾IO
cmd > file °Ñ stdout ÖØ¶¨Ïòµ½ file ÎļþÖÐ
cmd >> file °Ñ stdout ÖØ¶¨Ïòµ½ file ÎļþÖÐ(×·¼Ó)
cmd 1> fiel °Ñ stdout ÖØ¶¨Ïòµ½ file ÎļþÖÐ
cmd > file 2>&1 °Ñ stdout ºÍ stderr Ò»ÆðÖØ¶¨Ïòµ½ file ÎļþÖÐ
cmd 2> file °Ñ stderr ÖØ¶¨Ïòµ½ file ÎļþÖÐ
cmd 2>> file °Ñ stderr ÖØ¶¨Ïòµ½ file ÎļþÖÐ(×·¼Ó)
cmd >> file 2>&1 °Ñ stderr ºÍ stderr Ò»ÆðÖØ¶¨Ïòµ½ file ÎļþÖÐ(×·¼Ó)
cmd < file >file2 cmd ÃüÁîÒÔ file Îļþ×÷Ϊ stdin£¬ÒÔ file2 Îļþ×÷Ϊ stdout
cat <>file ÒÔ¶ÁдµÄ·½Ê½´ò¿ª file
cmd < file cmd ÃüÁîÒÔ file Îļþ×÷Ϊ stdin
cmd << delimiter Here document£¬´Ó stdin ÖжÁÈ룬ֱÖÁÓöµ½ delimiter ·Ö½ç·û
3¡¢ ½ø½×IO
>&n ʹÓÃϵͳµ÷Óà dup (2) ¸´ÖÆÎļþÃèÊö·û n ²¢°Ñ½á¹ûÓÃ×÷±ê×¼Êä³ö
<&


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

LinuxÁ÷Á¿¿ØÖÆ2

 Ê¹ÓùýÂËÆ÷·ÖÀà
ÿ¿éÍø¿¨¶¼ÓÐÒ»¸ö³ö¿Ú¸ùÅŶӹæÔò£¬È±Ê¡Çé¿öÏÂÊÇpfifo_fast ÅŶӹæÔò¡£Ã¿¸öÅŶӹæÔò¶¼Ö¸¶¨Ò»¸ö¾ä±ú£¬¾ä±úÓÐÁ½¸ö²¿·Ö£¬Ò»¸öÖ÷ºÅÂëºÍÒ»¸ö´ÎºÅÂ롣ϰ¹ßÉϰѸù¶ÓÁй涨³ÆÎª“1£º”£¬µÈ¼ÛÓÚ“1£º0”¡£ÀàµÄÖ÷ºÅÂë±ØÐëÓëËüÃǸ¸±²µÄÖ÷ºÅÂëÒ»Ö¡£ÈçÏÂͼ¡£
 
 
 
  ......

LINUXµÄÈȲå°Î»úÖÆ£¨¾­µäÎÄÕ£©

 linuxµÄÈȲå°ÎÊÇGreg Kroah-Hartmanά»¤£¬ËùÒÔÕâÊÇÆª¾­µäÎÄÕ¡£Èç¹ûÄãÓÐUSB»òÕßPCIÉ豸Çý¶¯¿ª·¢»ù´¡£¬Ò»¶Á¾Í¿ÉÒÔÀí½â¡£
Hot-pluggable devices have been created to solve a number of user needs. On laptop computers, PCMCIA devices were designed to allow the user to swap cards while the computer was sti ......

linux¶à½ø³Ì±à³Ì

 ÔÚlinuxÖÐ,ÔËÐеÄÒ»¸ö½ø³Ì,»áռȥlinuxµÄÈý¸öµØ·½,´úÂëÇø,¶ÑÕ»ÇøºÍÊý¾ÝÇø.Èç¹ûͬʱÔËÐжà¸öÏàͬµÄ³ÌÐò,ËûÃǾͻáʹÓÃÏàͬµÄ´úÂëÇø,´úÂëÇøÖдæ·ÅµÄ¾Í³ÌÐòµÄ´úÂë,µ«ÊÇÊý¾ÝÇøºÍ¶ÑÕ»Çø·Ö±ð´æ·ÅµÄÊdzÌÐòµÄÊý¾Ý,È«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿,Òò´Ë¼´Ê¹ÊÇÏàͬµÄ³ÌÐò,Ò²²»¿ÉͬʱʹÓÃÏàͬµÄÊý¾ÝºÍ¶ÑÕ»Çø.
#include<stdio.h>
#incl ......

dz̸linuxÄÚºËÖеÄlist.h[2]

Á´±íµÄɾ³ý
83/*
84 * Delete a list entry by making the prev/next entries
85 * point to each other.
86 *
87 * This is only for internal list manipulation where we know
88 * the prev/next entries already!
89 */
90static inline void __list_del(struct list_head * prev, struct list_head * next)
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ