½ÓÏÂÀ´£¬ÎÒÃǽøÈësysfs²¿·Ö¡£¿´¿´
kobject_add()->create_dir()->sysfs_create_dir()
bus create file->sysfs create file()
. . .
ÕâЩsysfsº¯ÊýµÄÄÚÄ»¡£
˵°×ÁË£¬sysfs¾ÍÊÇÀûÓÃVFSµÄ½Ó¿ÚÈ¥¶ÁдkobjectµÄ²ã´Î½á¹¹£¬½¨Á¢ÆðÀ´µÄÎļþϵͳ¡£¹ØÓÚsysfsµÄÄÚÈݾÍÔÚfs/sysfs/Ï¡£ kobjectµÄ²ã´Î½á¹¹µÄ¸üÐÂÓëɾ³ý¾ÍÊÇÄÇЩÂÒÆß°ËÔãµÄXX_register()ÃǸɵÄÊÂÇé¡£
ÔÚkobject_add()ÀïÃ棬µ÷ÓÃÁËsysfs_create_dir()¡£ÈÃÎÒÃÇ¿´¿´Ëü¾¿¾¹ÊÇÈçºÎcreateµÄ¡£
135 int sysfs_create_dir(struct kobject * kobj)
136 {
137 struct dentry * dentry = NULL;
138 struct dentry * parent;
139 int error = 0;
140
&nb ......
Ç°Ãæ˵¹ý£¬Ö»ÒªÖªµÀÎļþµÄË÷Òý½ÚµãºÅ£¬¾Í¿ÉÒԵõ½ÄǸöÎļþ¡£µ«ÊÇÎÒÃÇÔÚ²Ù×÷Îļþʱ£¬´ÓûÌý˵˻áÄÃ×ÅË÷Òý½ÚµãºÅÀ´²Ù×÷Îļþ£¬ÎÒÃÇÖ»ÖªµÀÎļþÃû¶øÒÑ¡£ ËüÃÇÊÇÈçºÎ"ºÍг"ÆðÀ´µÄÄØ£¿linux°ÑĿ¼Ҳ¿´³ÉÒ»ÖÖÎļþ£¬ÀïÃæ¼Ç¼×ÅÎļþÃûÓëË÷Òý½ÚµãºÅµÄ¶ÔÓ¦¹Øϵ£¨Ä¿Â¼´æÔÚµÄÔÒò£©¡£±ÈÈçÔÚext3ÎļþϵͳÖУ¬Èç¹ûÎļþÊÇÒ»¸öÄ¿ ¼£¬ÄÇôËüµÄÄÚÈݾÍÊÇһϵÁÐext3_dir_entry_2µÄ½á¹¹
struct ext3_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT3_NAME_LEN]; /* File name */
};
¾Ù ¸öÀý×Ó£¬±ÈÈçÒª´ò¿ª/home/test/hello.c¡£Ê×ÏÈ£¬ÕÒµ½‘/’£¬¶ÁÈëÆäÄÚÈÝ£¬ÕÒµ½ÃûΪ"home"µÄÎļþµÄË÷Òý½ÚµãºÅ£¬´ò¿ª/homeÕâ¸ö "Îļþ"£¬¶ÁÈëÄÚÈÝ£¬ÕÒµ½ÃûΪ "test" µÄµÄÎļþµÄË÷Òý½ÚµãºÅ£¬Í¬Àí£¬ÔÙ´ò¿ªÎļþ"/home/test"£¬ÕÒµ½ÕÒµ½ÃûΪ"hello.c”µÄÎļþµÄË÷Òý½ÚµãºÅ£¬×îºó¾ÍµÃµ½ /home/test/hello.cÁË¡£Õâ¾ÍÊÇpat ......
ÔÚPOSIXÖУ¬±ãÓÐ×ÅÖ§³ÖÕýÔò±í´ïʽµÄϵͳº¯Êý¡£GNU/LinuxÓÐÁ½Ì׿â¿ÉÓÃÓÚÕýÔò±í´ïʽ±à³Ì£ºPOSIX¿âºÍPCRE¿â¡£Ç°Õß²»ÐèÒªµ¥¶À°²×°£¬Ò»°ãÐèÇó»¹ÊÇÄÜÂú×ãµÄ£¬ËÙ¶ÈÉÔÂýЩ¡£ºóÕßÊǾøºÊ¢ÃûµÄPerlÕýÔò±í´ïʽ¿â£¬¹¦ÄÜÇ¿´ó£¬Æ¥ÅäËٶȿ죬²»¹ý¿ÉÄÜÐèÒªµ¥¶À°²×°¡£
int regcomp (regex_t *compiled, const char *pattern, int cflags)
²ÎÊýcompiledÖ»ÓÐÒ»¸ö³ÉÔ±ÊÇÎÒÃÇÐèÒª¹Ø×¢µÄ£¬ÄǾÍÊÇre_nsub£¬´ú±í±àÒëºóµÄ×Ó±í´ïʽÊýÄ¿£¬ÓÉÓÚÎÒÃÇ»¹ÐèÒª±£´æÕû¸öÆ¥Åäµ½µÄģʽ£¬ËùÒÔ×îÖÕÆ¥ÅäµÄÌõÄ¿ÊýÊÇre_nsub¼Ó1¡£cflagsÓÃÀ´ÐÞÊÎÆ¥Åäģʽ£¬¿ÉÈ¡ÖµÈçÏ£º
REG_EXTENDED ÆôÓÃPOSIXÕýÔò¿âÀ©Õ¹£¬¹ØÓÚ¸ÃÀ©Õ¹µÄÏêϸÐÅÏ¢¿É²Î¿¼POSIX¹æ·¶
REG_ICASE ºöÂÔ´óСд
REG_NOSUB ²»Òª´æ´¢×Ó±í´ïʽ
REG_NEWLINE °Ñ»»Ðзû×÷Ϊ¶àÐеķָô·û£¬ÕâÑù'$'¿ÉÆ¥ÅäÿһÐеÄÐÐ⣬'^'Æ¥ÅäÿһÐеÄÐÐÊ×£¬'.'²»Æ¥Åä»»Ðзû£¬[^...]²»Æ¥ÅäÐÂÐС£
²ÎÊýregexÊÇÒ»¸ö×Ö·û´®£¬Ëü´ú±í½«Òª±»±àÒëµÄÕýÔò±í´ïʽ;²ÎÊýpregÖ¸ÏòÒ»¸öÉùÃ÷Ϊregex_tµÄÊý¾Ý½á¹¹£¬ÓÃÀ´±£´æ±àÒë½á¹û;²ÎÊýcflags¾ö¶¨ÁËÕýÔò±í´ïʽ¸ÃÈçºÎ±»´¦ÀíµÄϸ½Ú¡£
¡¡¡¡Èç¹ûº¯Êýregcomp()Ö´Ðгɹ¦£¬²¢ÇÒ±àÒë½á¹û±»ÕýÈ·Ìî³äµ½pregÖк󣬺¯Êý½«·µ»Ø0£¬Èκ ......
ÔÚPOSIXÖУ¬±ãÓÐ×ÅÖ§³ÖÕýÔò±í´ïʽµÄϵͳº¯Êý¡£GNU/LinuxÓÐÁ½Ì׿â¿ÉÓÃÓÚÕýÔò±í´ïʽ±à³Ì£ºPOSIX¿âºÍPCRE¿â¡£Ç°Õß²»ÐèÒªµ¥¶À°²×°£¬Ò»°ãÐèÇó»¹ÊÇÄÜÂú×ãµÄ£¬ËÙ¶ÈÉÔÂýЩ¡£ºóÕßÊǾøºÊ¢ÃûµÄPerlÕýÔò±í´ïʽ¿â£¬¹¦ÄÜÇ¿´ó£¬Æ¥ÅäËٶȿ죬²»¹ý¿ÉÄÜÐèÒªµ¥¶À°²×°¡£
int regcomp (regex_t *compiled, const char *pattern, int cflags)
²ÎÊýcompiledÖ»ÓÐÒ»¸ö³ÉÔ±ÊÇÎÒÃÇÐèÒª¹Ø×¢µÄ£¬ÄǾÍÊÇre_nsub£¬´ú±í±àÒëºóµÄ×Ó±í´ïʽÊýÄ¿£¬ÓÉÓÚÎÒÃÇ»¹ÐèÒª±£´æÕû¸öÆ¥Åäµ½µÄģʽ£¬ËùÒÔ×îÖÕÆ¥ÅäµÄÌõÄ¿ÊýÊÇre_nsub¼Ó1¡£cflagsÓÃÀ´ÐÞÊÎÆ¥Åäģʽ£¬¿ÉÈ¡ÖµÈçÏ£º
REG_EXTENDED ÆôÓÃPOSIXÕýÔò¿âÀ©Õ¹£¬¹ØÓÚ¸ÃÀ©Õ¹µÄÏêϸÐÅÏ¢¿É²Î¿¼POSIX¹æ·¶
REG_ICASE ºöÂÔ´óСд
REG_NOSUB ²»Òª´æ´¢×Ó±í´ïʽ
REG_NEWLINE °Ñ»»Ðзû×÷Ϊ¶àÐеķָô·û£¬ÕâÑù'$'¿ÉÆ¥ÅäÿһÐеÄÐÐ⣬'^'Æ¥ÅäÿһÐеÄÐÐÊ×£¬'.'²»Æ¥Åä»»Ðзû£¬[^...]²»Æ¥ÅäÐÂÐС£
²ÎÊýregexÊÇÒ»¸ö×Ö·û´®£¬Ëü´ú±í½«Òª±»±àÒëµÄÕýÔò±í´ïʽ;²ÎÊýpregÖ¸ÏòÒ»¸öÉùÃ÷Ϊregex_tµÄÊý¾Ý½á¹¹£¬ÓÃÀ´±£´æ±àÒë½á¹û;²ÎÊýcflags¾ö¶¨ÁËÕýÔò±í´ïʽ¸ÃÈçºÎ±»´¦ÀíµÄϸ½Ú¡£
¡¡¡¡Èç¹ûº¯Êýregcomp()Ö´Ðгɹ¦£¬²¢ÇÒ±àÒë½á¹û±»ÕýÈ·Ìî³äµ½pregÖк󣬺¯Êý½«·µ»Ø0£¬Èκ ......
Linux/UNIX C++¸ß¼¶Åàѵ---Ô¶³Ì°à
http://www.xuanyuan-soft.cn/index.php?option=com_content&view=article&id=84&Itemid=85
¿Î³Ì¸ÅÒª
ÅàÑøÄ¿±ê
£ºLinux/UNIX C++Èí¼þ¹¤³Ìʦ
רעLinux/UNIX·þÎñÆ÷¶ËµÄÈí¼þ¿ª·¢£¨ºǫ́¿ª·¢£©£¬ÅàÑøÆóÒµËùÐèµÄרҵLinux/UNIX C++Èí¼þ¹¤³Ìʦ¡£
¿Î³ÌÉæ¼°·þÎñÆ÷¶ËÈí¼þ¿ª·¢µÄ·½·½ÃæÃ棺Linux/UNIX¡¢C++¡¢Boost¡¢ACE¡¢Shell±à³Ì¡¢Oracle/MySQL¡¢Êý¾Ý¿â½¨Ä£¡¢UML½¨Ä£¡¢ÏîĿʵ¼ù¡¢¿ª·¢Ä£Ê½
µÈµÈ¡£ÎÒÃÇÏ£Íû´ÓÐùÔ¯±ÏÒµµÄѧԱ²»½öÊÇCoder£¬¶øÇÒÓ¦¸ÃÊÇDesigner£¡
¿Î³Ì´ó¸Ù
Ò»¡¢Linux²Ù×÷ϵͳ
ϵͳ»·¾³£ºUbuntu GNU/Linux¡¢RedHat Linux AS5¡¢FreeBSD
¿Î³ÌÒªÇó£ºÊìÁ·Ê¹Óó£ÓõÄLinux/UNIXÃüÁî¡£
ʱ¼ä£º1ÖÜ¡£
¶þ¡¢Linux C++¿ª·¢»·¾³´î½¨¡¢¿ª·¢¹¤¾ßµÄʹÓÃ
Éæ¼°ÄÚÈÝ£ºvi¡¢GCC¡¢GDB¡¢Make¡¢CVS¡¢Subversion¡¢Eclipse CDT
¿Î³ÌÒªÇó£º
ÊìÁ·Ê¹ÓÃviÎı¾±à¼Æ÷£»
ÊìÁ·Ê¹ÓÃGCC¹¤¾ßÁ´½øÐбàÒë¡¢µ÷ÊÔ¡¢¹¹½¨¿ÉÖ´ÐÐÎļþ»ò¹²Ïí¿â/¾²Ì¬¿â£»
ÊìÁ·±àдMakefile£»
ÊìÁ·ÅäÖá¢Ê¹ÓÃCVSºÍSubversionÁ½ÖÖ°æ±¾¿ØÖƹ¤¾ß£»
ÊìÁ·ÅäÖá¢Ê¹ÓÃEclipse CDT¿ª·¢¹¤¾ß¡£
ʱ¼ä£º1ÖÜ
Èý¡¢C++ÓïÑÔ
......
Linux/UNIX C++¸ß¼¶Åàѵ---Ô¶³Ì°à
http://www.xuanyuan-soft.cn/index.php?option=com_content&view=article&id=84&Itemid=85
¿Î³Ì¸ÅÒª
ÅàÑøÄ¿±ê
£ºLinux/UNIX C++Èí¼þ¹¤³Ìʦ
רעLinux/UNIX·þÎñÆ÷¶ËµÄÈí¼þ¿ª·¢£¨ºǫ́¿ª·¢£©£¬ÅàÑøÆóÒµËùÐèµÄרҵLinux/UNIX C++Èí¼þ¹¤³Ìʦ¡£
¿Î³ÌÉæ¼°·þÎñÆ÷¶ËÈí¼þ¿ª·¢µÄ·½·½ÃæÃ棺Linux/UNIX¡¢C++¡¢Boost¡¢ACE¡¢Shell±à³Ì¡¢Oracle/MySQL¡¢Êý¾Ý¿â½¨Ä£¡¢UML½¨Ä£¡¢ÏîĿʵ¼ù¡¢¿ª·¢Ä£Ê½
µÈµÈ¡£ÎÒÃÇÏ£Íû´ÓÐùÔ¯±ÏÒµµÄѧԱ²»½öÊÇCoder£¬¶øÇÒÓ¦¸ÃÊÇDesigner£¡
¿Î³Ì´ó¸Ù
Ò»¡¢Linux²Ù×÷ϵͳ
ϵͳ»·¾³£ºUbuntu GNU/Linux¡¢RedHat Linux AS5¡¢FreeBSD
¿Î³ÌÒªÇó£ºÊìÁ·Ê¹Óó£ÓõÄLinux/UNIXÃüÁî¡£
ʱ¼ä£º1ÖÜ¡£
¶þ¡¢Linux C++¿ª·¢»·¾³´î½¨¡¢¿ª·¢¹¤¾ßµÄʹÓÃ
Éæ¼°ÄÚÈÝ£ºvi¡¢GCC¡¢GDB¡¢Make¡¢CVS¡¢Subversion¡¢Eclipse CDT
¿Î³ÌÒªÇó£º
ÊìÁ·Ê¹ÓÃviÎı¾±à¼Æ÷£»
ÊìÁ·Ê¹ÓÃGCC¹¤¾ßÁ´½øÐбàÒë¡¢µ÷ÊÔ¡¢¹¹½¨¿ÉÖ´ÐÐÎļþ»ò¹²Ïí¿â/¾²Ì¬¿â£»
ÊìÁ·±àдMakefile£»
ÊìÁ·ÅäÖá¢Ê¹ÓÃCVSºÍSubversionÁ½ÖÖ°æ±¾¿ØÖƹ¤¾ß£»
ÊìÁ·ÅäÖá¢Ê¹ÓÃEclipse CDT¿ª·¢¹¤¾ß¡£
ʱ¼ä£º1ÖÜ
Èý¡¢C++ÓïÑÔ
......
±¾½ÚºÍ´ó¼ÒÒ»ÆðѧϰһÏÂÔÚlinuxÏÂʹÓÃapache+svn+sslÅäÖð²È«°æ±¾¿ØÖÆƽ̨ÎÊÌ⣬¿´Íê±¾ÎÄÄã¿Ï¶¨Óв»ÉÙÊÕ»ñ£¬Ï£Íû±¾ÎÄÄ̻ܽáÄã¸ü¶à¶«Î÷¡£Ê×ÏȽéÉÜÒ»ÏÂlinuxÏÂapache+svn+sslÅäÖõĻ·¾³¡£
»·¾³£º
centos5.4_x64
apache2.2.14
subversion-1.4.2(µ£ÐÄ°ü¹ØÁªÐÔÎÊÌ⣬¾ÍûÓп¼ÂÇ×îа汾£©
°²×°¹ý³Ì£º
1£¬apache°²×°
#./configure--prefix=/usr/local/apache--enable-so--enable-dav=shared--enable-dav-fs=shared--enable-dav-lock=shared--enable-ssl=shared
make
makeinstallÈç¹ûÕą̂apache²»×öÆäËûʹÓã¬Õâ¸öÅäÖþÍÒѾ×ã¹»
2£¬subversion°²×°
subversion-1.4.2]#./autogen.sh#½¨ÒéÏÈÖ´ÐдËÁìÃü£¬subversion»á½øÐгõʼ»¯£¬Ö®Ç°ÎÃ×ÓÔÚmakeµÄʱºò±¨´í£¬ºóÀ´Ö´Ðд˲Ù×÷ºó£¬make¾Í˳Àû¹ýÈ¥ÁË
subversion-1.4.2]#./configure--with-apxs=/usr/local/apache/bin/apxs--with-apr=/usr/local/apache/bin/apr-1-config--with-apr-util=/usr/local/apache/bin/apu-1-config--with-ssl
subversion-1.4.2]#make
subversion-1.4.2]#makeinstall
µ½´Ë£¬Èç¹ûûÓгö´í£¬°²×°¹¤×÷¾ÍÒѾÍê³ÉÁË£¬ÏÂÃæ½øÈëapache+svn+sslÅäÖý׶Ρ£
ÅäÖùý³Ì£º
1£¬apacheµÄÅäÖÃ
Õý³£°²×°ÏÂ
LoadM ......
ÔÚLinuxϱàдDaemon
ÔÚLinux£¨ÒÔRedhat Linux Enterprise Edition 5.3ΪÀý£©Ï£¬ÓÐʱÐèÒª±àдService¡£ServiceÒ²ÊdzÌÐò£¬Ò»°ãËæϵͳÆô¶¯Óû§²»¸ÉÔ¤¾Í²»Í˳öµÄ³ÌÐò£¬¿ÉÒÔ³ÆΪService¡£LinuxϵÄServiceÒ»°ã³ÆΪDaemon¡£
ÒÔÉÏÊǹãÒåµÄServiceµÄ¶¨Òå¡£LinuxϵķþÎñÒ»°ã·ÅÔÚ/etc/init.dÎļþ¼ÐÏ¡£ä¯ÀÀÒ»ÏÂÕâ¸öÎļþ¼ÐϵÄÎļþ£¬¿ÉÒÔ·¢ÏÖÔÚLinuxϱàдServiceÒ»°ã×ñѵÄÔÔò¡£
LinuxϱàдServiceÒ»°ã×ñѵÄÔÔò
1£©ÕæÕýÔËÐеÄServiceÒ»°ã·ÅÔÚij¸öbinĿ¼Ï£¨/bin£¬/usr/bin£¬etc£©¡£
2£©/etc/init.dÎļþ¼ÐÏÂÒ»°ãÊÇshell½Å±¾£¬ÓÃÀ´¿ØÖÆbinĿ¼ÏµÄService¡£
3£©/etc/init.dÎļþ¼ÐϵÄshell½Å±¾Ò»°ã½ÓÊÜÖÁÉÙÁ½¸ö²ÎÊý£¬startºÍstop¡£»¹ÓÐÆäËû³£ÓõĿÉÑ¡²ÎÊýÈçstatus£¬reload£¬restart£¬µÈ¡£
4£©/etc/init.dÎļþ¼ÐϵÄshell½Å±¾ÖÁÉÙ°üÀ¨Á½ÐÐ×¢ÊÍ£¬Ò»ÐиæËßchkconfig´Ë·þÎñÔËÐеÄrunlevel£¬Æô¶¯ÓÅÏȼ¶£¬½áÊøÓÅÏȼ¶¡£Ò»ÐиæËßchkconfig´Ë·þÎñµÄÃèÊö¡£
LinuxµÄÆô¶¯¹ý³ÌºÍRunLevel
ÒªÀí½âLinuxµÄÆô¶¯¹ý³ÌºÍRunLevel£¬¿ÉÒÔÏÈä¯ÀÀÒ»ÏÂ/etc/inittabÎļþ¡£ÔÚ/etc/inittabÖж¨ÒåÁËÏÂÃæ7ÖÖRunLevel¡£Ã¿¸öService¿ÉÒÔÉèÖÃ×Ô¼ºÔÚÄĸöRunLevelÏÂÔËÐС£¿É ......