linuxĿ¼²Ù×÷º¯Êý£ÛתUC£Ý
ת×Ô£º
http://blog.chinaunix.net/u2/63316/showart_547992.html
LinuxϵÄĿ¼ÊÇÒÀÕÕ±ê×¼À´Êµ×÷µÄ£¬Òò´Ë£¬Äú¿ÉÒÔºÁÎÞÎÊÌâµØÒÆÖ³µ½ÈκÎÆäËüUNIXƽ̨¡£
--------------------------------------------------------------------------------
getcwd/getwd : È¡µÃÄ¿Ç°ËùÔÚĿ¼
--------------------------------------------------------------------------------
#include
char * getcwd(char *buf,size_t size);
buf½«»á·µ»ØĿǰ·¾¶Ãû³Æ¡£
ÈκεĴíÎó·¢Éú£¬½«»á·µ»ØNULL¡£Èç¹û·¾¶³¤¶È³¬¹ýsize£¬errnoΪERANGE¡£getcwd·µ»ØµÄÖµÓÀÔ¶ÊÇûÓÐsymbol linkµÄ¡£
--------------------------------------------------------------------------------
#include
char *getwd(char *buf);
getwdÊǸöΣÏյĺ¯Êý£¬Ò»°ã¶¼»áÇ¿ÁÒ½¨Òé²»ÒªÓã¬ÒòΪÄúÎÞ·¨È·¶¨×µÄĿ¼³¤¶ÈΪ¶àÉÙ¡£PATH_MAX¶¨ÒåÁË×µÄ·¾¶³¤¶È¡£ÔÚLinuxÏÂËùÒÔÌṩÕâ¸öº¯ÊýÖ÷ÒªÊÇÒòΪ¡¸´«Í³¡¹¡£
--------------------------------------------------------------------------------
//»ñȡϵͳĿ¼×î´ó³¤¶È
long pathconf(char* path, int flag);
--------------------------------------------------------------------------------
chdir/fchdir/chroot : ¸Ä±äÄ¿Ç°ËùÔÚĿ¼
--------------------------------------------------------------------------------
#include
int chdir(const char * pathname);
int fchdir(int fd);
chdir¸ù¾Ýpathname±ä¸üÄ¿Ç°µÄËùÔÚĿ¼£¬ËüÖ»¸Ä±ä¸Ã³ÌʽµÄËùÔÚĿ¼¡£
fchdir¸ù¾ÝÒÑ¿ªÆôµÄfd(file descriptor)Ŀ¼À´±ä¸ü¡£
//sample
/*¸ü¸Äµ±Ç°¹¤×÷Ŀ¼µ½Éϼ¶Ä¿Â¼*/
if(chdir("..")==-1){
perror("Couldn't change current working directory.\n");
return 1;
}
--------------------------------------------------------------------------------
#include
int chroot(const char * path);
chroot¸Ä
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
²é¿´´ÅÅÌÒÔ¼°·ÖÇøÃüÁ
fdisk -l
Êä³ö½á¹ûÈçÏ£º
-----------------------------------------------------------------------
Disk /dev/sda: 160.0 GB, 160040803840 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot   ......
¹¦ÄÜÃèÊö£º
»ñÈ¡»òÕßÉèÖÃ
Óëij¸öÌ×½Ó×Ö¹ØÁªµÄÑ¡ ÏѡÏî¿ÉÄÜ´æÔÚÓÚ¶à²ãÐÒé
ÖУ¬ËüÃÇ×Ü»á³öÏÖÔÚ×îÉÏÃæµÄÌ×½Ó×ֲ㡣µ±²Ù×÷Ì×½Ó×ÖÑ¡Ïîʱ£¬Ñ¡ÏîλÓڵIJãºÍÑ¡ÏîµÄÃû³Æ±ØÐë¸ø³ö¡£ÎªÁ˲Ù×÷Ì×½Ó×Ö²ãµÄÑ¡ÏӦ¸Ã ½«²ãµÄÖµÖ¸¶¨ÎªSOL_SOCKET¡£ÎªÁ˲Ù×÷ÆäËü²ãµÄÑ¡Ï¿ØÖÆÑ¡ÏîµÄºÏÊÊÐ ......