The Linux Kernel Module Programming Guide
http://www.faqs.org/docs/kernel/
µÄ11ºÍ12ÔÙÊÔÊÔ¡£
Linux Äں˵ÄWorkQueues API×öÁËÐÞ¸Ä
WorkQueue»úÖÆÔÊÐíÄں˴úÂëÔÚÍíÒ»µãµÄʱ¼äÖ´ÐС£Workqueueͨ¹ý´æÔÚµÄÒ»¸ö»òÕ߶à¸öרÃŵĽø³ÌʵÏÖ£¬È¥Ö´ÐжÓÁй¤×÷¡£ÒòΪÔÚ½ø³ÌµÄÉÏÏÂÎÄ»ã×ÜÖ´ÐУ¬Òò´ËÈç¹ûÐèÒª£¬Æä¿ÉÒÔsleep¡£WorkQueueÒ²¿ÉÒÔÑÓ³ÙÌض¨Ê±¼äÖ´Ðй¤×÷¡£ËùÒÔËüÃÇÔÚÄÚºËÖÐÐí¶àµØ·½Ê¹Óá£
David Howells×î½ü¼ì²éworkqueueʱ·¢ÏÖwork_struct£¨ÓÃÀ´ÃèÊöÒ»¸ö³ÌÐòÖ´ÐУ©ÊÇÏ൱´óµÄ£¬ÔÚ64-bit»úÆ÷ÉÏÓÐ96bytes£¬ÕâÊÇÏ൱´óµÄÊý¾Ý½á¹¹£¬ÒòΪºÜ¶àµØ·½¶¼Ê¹ÓÃÕâ¸ö½á¹¹¡£Òò´ËËûÏë³ö°ì·¨°ÑËüÃDZäС£¬Ëû³É¹¦Á˵«ÊÇÐèÒª¸Ä¶¯workqueueµÄAPI.
µ¼ÖÂstruct work_structÓ·Ö×µÄÔÒòÊÇ£º
1.ÆäÖÐËù°üº¬timer structure¡£Ðí¶àworkqueueµÄÓû§´ÓÀ´²»Ê¹ÓÃÕâ¸ödelayÌØÐÔ£¬µ«ÊÇÔڽṹÌåÄÚ¶¼°üº¬timer_list½á¹¹¡£
2.˽ÓÐÊý¾ÝÖ¸Õ룬ÕâÊÇ´«µÝ¸øworkº¯ÊýµÄ²ÎÊý¡£Ðí¶àº¯ÊýʹÓÃÕâ¸öÖ¸Õ룬µ«ÊÇËüͨ³£¿ÉÒÔ´Ówork_structÖ¸ÕëÖÐÓÃcontain_of()¼ÆËã³öÀ´¡£
3.Ò»¸öwordÖ»ÓÃÒ»¸öbitÀ´±íʾpending£¬ÓÃÀ´ËµÃ÷Õâ¸öwork_structÄ¿Ç°ÔÚ¶ÓÁÐÉϵȴýÖ´ÐС£
David´¦ÀíÁËÒÔÉϵÄÇé¿ö£¬Ê¹ÓÃÁËÒ»ÖÖеĽṹÌåstruct delayed_work£¬×¨ÃÅÓÃÓÚÑÓʱµ÷ÓÃʹÓ᣶ø°Ñstruct work_structureÖеÄtimer½á¹¹Ìåɾ³ýÁË¡£Ë½ÓÐÊý¾ÝÖ¸ÕëÏûʧÁË£¬workº¯ÊýʹÓÃÒ»¸öÖ¸Ïòwork_structureµÄÖ¸Õ룬typedef void (*work_func_t)(struct work_struct *work)¡£Ê¹ÓÃһЩ¼¼ÇÉɾ³ýÁËpending word¡£ÕâЩ±ä¶¯µÄ½á¹ûʹµÃworkqueueµÄAPI·¢ÉúÁ˱仯¡£ÓÐÁ½ÖÖ·½·¨ÉùÃ÷Ò»¸öworkqueueµÄentry¡£
DECLARE_WORK(name, func);
DECLARE_DELAYED_WORK(name, func);
¶ÔÓÚÔÚÔËÐÐʱÉú³ÉµÄwork structure£¬³õʼ»¯ºêÏÖÔÚÈçÏ£º
INIT_WORK(struct work_struct work, work_func_t func);
PREPARE_WORK(struct work_struct work, work_func_t func);
INIT_DELAYED_WORK(struct delayed_work work, work_func_t func);
PREPARE_DELAYED_WORK(struct delayed_work work, work_func_t func);
INIT_*°æ±¾µÄºê³õʼ»¯Õû¸ö½á¹¹£¬ËüÃDZØÐëÔÚÕâ¸ö½á¹¹µÚÒ»´Î³õʼ»¯µÄʱºòʹÓã¬PREPARE_*°æ±¾µÄºêÔËÐÐËÙ¶ÈÉÔ΢¿ìЩ¡£
The functions for adding entries to workqueues (and canceling them) now look like this:
int queue_work(struct workqueue_struct *queue,
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
1¡¢¼òµ¥²âÊÔʵÀý
for i in `find . -type f -name "*.c"`
do
echo $i
basename $i »ñÈ¡*.cÎļþÃû
dirname $i »ñÈ¡*.c¶ÔÓ¦µÄĿ¼Ãû
done
2¡¢Êµ¼ÊÓ¦ÓÃ
diff LinuxÔ´Â룬²¢½«Óв»Ò»ÑùµÄÔ´ÂëÕûÀíÔÚÒ»Æð£¬ÒªÇó£ºÎļþ ......
sys_execve
| - do_execve
|
| - search_binary_handler
|- linux_binfmt= elf_format
|- elf_format-> load_elf_binary
| -&nbs ......
Î壺kmem_cache_create£¨£©·ÖÎö
ÎÒÃÇÒÔÒ»¸öÀý×ÓÀ´¸ú×Ù·ÖÎöÒ»ÏÂslabµÄ»úÖÆ£º
ÏÂÃæÊÇÒ»¸ö²âÊÔÄ£¿éµÄ´úÂ룺
#include <linux/config.h>
#include <linux/module.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ericxiao <xgr178@163.com>");
MODULE_DESCRI ......