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

Linux Kernel Linked List Explained

²Î¼û£ºhttp://isis.poly.edu/kulesh/stuff/src/klist/
Introduction:
Linux kernel is mostly written in the C language. Unlike many other languages C does not have
a good collection of data structures built into it or supported by a collection of standard libraries.
Therefore, you're probably excited to hear that you can borrow a good implementation of a
circularly-linked list in C from the Linux kernel source tree.
The file include/linux/list.h
in the source tree implements a type oblivious, easy-to-use, circularly-linked list in the C
language. The implementation is efficient and portable-- otherwise it would not have made it
into the kernel. Whenever someone needs a list in the Linux kernel they rely on this
implementation to strung up any data structure they have. With very little modifications
(removing hardware prefetching of list items) we can also use this list in our applications.
A usable version of this file is available
here for download
.
Some of the advantages of using this list are:
Type Oblivious:
This list can be used to strung up any data structure you have in mind.
Portable:
Though I haven't tried in every platform it is safe to assume the list implementation
is very portable. Otherwise it would not have made it into the kernel source tree.
Easy to Use:
Since the list is type oblivious same functions are used to initialize, access,
and traverse any list of items strung together using this list implementation.
Readable:
The macros and inlined functions of the list implementation makes the resulting
code very elegant and readable.
Saves Time:
Stops you from reinventing the wheel. Using the list really saves a lot of
debugging time and repetitively creating lists for every data structure
you need to link.
Linux implementation of the linked list is different from the many
linked list

implementations you might have seen. Usually a linked list contains
the items that are to be linked. For example:
struct my_li


Ïà¹ØÎĵµ£º

linux grepÃüÁǿ´óµÄÎı¾ËÑË÷

linux grepÃüÁǿ´óµÄÎı¾ËÑË÷
1.×÷ÓÃ
linuxϵͳÖÐgrepÃüÁîÊÇÒ»ÖÖÇ¿´óµÄÎı¾ËÑË÷¹¤¾ß£¬ËüÄÜʹÓÃÕýÔò±í´ïʽËÑË÷Îı¾£¬²¢°ÑÆ¥ÅäµÄÐдòÓ¡³öÀ´¡£grepÈ«³ÆÊÇGlobal Regular Expression Print£¬±íʾȫ¾ÖÕýÔò±í´ïʽ°æ±¾£¬ËüµÄʹÓÃȨÏÞÊÇËùÓÐÓû§¡£
2.¸ñʽ
grep [options]
3.Ö÷Òª²ÎÊý
[options]Ö÷Òª²ÎÊý£º
£­c£ºÖ»Êä³öÆ¥Åä ......

½â¾ölinux vimÂÒÂëÎÊÌâ

VimºÍËùÓеÄÁ÷ÐÐÎı¾±à¼­Æ÷Ò»Ñù£¬Vim ¿ÉÒԺܺõı༭¸÷ÖÖ×Ö·û±àÂëµÄÎļþ£¬Õ⵱Ȼ°üÀ¨ UCS-2¡¢UTF-8 µÈÁ÷ÐÐµÄ Unicode ±àÂ뷽ʽ¡£È»¶ø²»ÐÒµÄÊÇ£¬ºÍºÜ¶àÀ´×Ô Linux ÊÀ½çµÄÈí¼þÒ»Ñù£¬ÕâÐèÒªÄã×Ô¼º¶¯ÊÖÉèÖá£
Vim ÓÐËĸö¸ú×Ö·û±àÂ뷽ʽÓйصÄÑ¡Ïencoding¡¢fileencoding¡¢fileencodings¡¢termencoding (ÕâЩѡÏî¿ÉÄܵÄÈ¡ÖµÇë ......

¹ØÓÚlinux»·¾³±äÁ¿Îļþ

/etc/profile:´ËÎļþΪϵͳµÄÿ¸öÓû§ÉèÖû·¾³ÐÅÏ¢,µ±Óû§µÚÒ»´ÎµÇ¼ʱ,¸ÃÎļþ±»Ö´ÐÐ.²¢´Ó/etc/profile.dĿ¼µÄÅäÖÃÎļþÖÐËѼ¯shellµÄÉèÖÃ.
/etc/bashrc:Ϊÿһ¸öÔËÐÐbash shellµÄÓû§Ö´ÐдËÎļþ.µ±bash shell±»´ò¿ªÊ±,¸ÃÎļþ±»¶ÁÈ¡.
~/.bash_profile:ÿ¸öÓû§¶¼¿ÉʹÓøÃÎļþÊäÈëרÓÃÓÚ×Ô¼ºÊ¹ÓõÄshellÐÅÏ¢,µ±Óû§µÇ¼ʱ, ......

¹ØÓÚlinux source£¬exportÃüÁһЩÒÉ»óµÄ½â¾ö

sourceÃüÁîÓ÷¨£º
source FileName
×÷ÓÃ:ÔÚµ±Ç°bash»·¾³Ï¶ÁÈ¡²¢Ö´ÐÐFileNameÖеÄÃüÁî¡£
×¢£º¸ÃÃüÁîͨ³£ÓÃÃüÁî“.”À´Ìæ´ú¡£
È磺source .bash_rc Óë . .bash_rc ÊǵÈЧµÄ¡£
sourceÃüÁî(´Ó C Shell ¶øÀ´)ÊÇbash shellµÄÄÚÖÃÃüÁî¡£µãÃüÁ¾ÍÊǸöµã·ûºÅ£¬(´ÓBourne Shell¶øÀ´)ÊÇsourceµÄÁíÒ»Ãû³Æ¡£Í¬Ñùµ ......

Linux/Ubuntu chmodÃüÁîÏê½âʹÓøñʽºÍ·½·¨

ÔÚ Ubuntu Linux ÖÐÓÃÔ´ÂëÎļþ°²×°Èí¼þ
ʱ¾­³£¶¼»áÓõ½chmod
ÃüÁîÀ´¸ü¸ÄÎļþµÄȨÏÞʹÆäÔÚ°²×°Ê±ÓÐÖ´ÐеÄȨÏÞ¡£ÓÉÓÚ Ubuntu Linux ĬÈϲ»ÄÜÓÃrootÕË»§À´µÇ¼ËùÒÔÔÚÓÃchmodÃüÁîÀ´¸ü¸ÄÎļþµÄȨÏÞʱÍùÍùÐèÒª½áºÏsudoÃüÁîÀ´Ê¹Óã¬Èç¹ûÄã¶ÔsudoÃüÁ²»Ì«Á˽⣬ÇëÏÈ¿´¿´±¾Õ¾µÄ¡¶sudoÃüÁîÏê½â¡·
chmod
Linux/Ubuntu
ϵͳÖÐÎÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ